How can I test the JSON string in the browser without going through the steps of downloading the json file as the File Download dialog pops up when I run the servlet, then viewing the downloaded json file in the browser.
below is the screen shot of postman - postman returns a 404
below is the web.xml for mapping
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">
  <!-- General Description of the web application -->  
  <display-name>webData</display-name>
  <description>data managed in web data table grid</description>  
     <!-- For directory request -->
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>
     <!-- Define servlets -->
  <servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet>
    <servlet-name>queryreturn</servlet-name>
    <servlet-class>com.queryData.Return.QueryReturn</servlet-class>  
  </servlet>
     <!-- Note: All <servlet> elements MUST be grouped together and
         placed IN FRONT of the <servlet-mapping> elements -->  
   <!-- Define servlet's URL mapping -->    
  <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>/faces/*</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>queryreturn</servlet-name>
    <url-pattern>/queryreturn</url-pattern>
  </servlet-mapping>
  <context-param>
    <description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description>
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>client</param-value>
  </context-param>
  <context-param>
    <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
    <param-value>resources.application</param-value>
  </context-param>
  <listener>
    <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
  </listener>
</web-app>
below is the bean that generates the JSON string successfully but won't run in the browser
package com.queryData.Return;
//Import required java libraries
import java.io.*;
import java.util.List;
import javax.servlet.*;
import javax.servlet.http.*;
import org.json.JSONObject;
import com.queryData.main.Main;
// Extend HttpServlet class
public class QueryReturn extends HttpServlet 
{
    private static final long serialVersionUID = 1L;
    public void init() throws ServletException
      {
          // Do required initialization
      }
      public void doGet(HttpServletRequest request,
                      HttpServletResponse response)
                throws ServletException, IOException
      {
          Main m = new Main();
          List<JSONObject> jObj = m.getJsonObject();
          StringBuilder sb = new StringBuilder();
          for(int i =0 ; i < jObj.size(); i++) 
          {
             sb.append(jObj.get(i).toString());
          }         
          String responseStr = "{\"data\":[" + sb + "]}";
          // Set response content type
          response.setContentType("application/json");
          // Actual logic goes here.
          PrintWriter out = response.getWriter();
          out.println(responseStr);
      }
      public void destroy()
      {
          // do nothing.
      }
}
 
     
     
     
    