title: Create a simple page that returns a JSON response
body: <p>The team that works on the client side in my project has asked me to write a sample test page, and give them a working URL that they can hit and get back 200. They have asked me to also give a sample request body.
  Here is the request body I will be giving to them.</p>
  
  <pre><code>{
  "MyApp": {
      "mAppHeader": {
          "appId": "",
          "personId": "",
          "serviceName": "",
          "clientIP": "",
          "requestTimeStamp": "",     
          "encoding": "",
          "inputDataFormat": "",
          "outputDataFormat": "",
          "environment": ""
      },
     "requestPayload": {
          "header": {
              "element": ""
          },
          "body": {
              "request": {
                  "MyTestApp": {
                      "data": {
                          "AuthenticationRequestData": {
                              "appId": "",
                              "appPwd": ""
                          }
                      }
                  }
              }
          }
      }
      }
  }
  </code></pre>
  
  <p>To develop the sample page, I have no idea where to start. Please go easy on your downvotes (in case the question seems irrelevant) as I have no experience working on JSP Servlets.</p>
  
  <p>Here is what I have as of now. Its a simple login page -</p>
  
  <pre><code>    &lt;%@ page language="java" 
      contentType="text/html; charset=windows-1256"
      pageEncoding="windows-1256"
  %&gt;
  
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  "http://www.w3.org/TR/html4/loose.dtd"&gt;
  
  &lt;html&gt;
      &lt;head&gt;
          &lt;meta http-equiv="Content-Type" content="text/html; charset=windows-1256"&gt;
          &lt;title&gt;Login Page&lt;/title&gt;
      &lt;/head&gt;
  
      &lt;body&gt;
          &lt;form action="TestClient"&gt;
  
              AppId       
              &lt;input type="text" name="appID"/&gt;&lt;br&gt;       
  
              AppPassword
              &lt;input type="text" name="appPwd"/&gt;
  
              &lt;input type="submit" value="submit"&gt;            
  
          &lt;/form&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>And this is my servlet class - </p>
  
  <pre><code> package com.test;
  
  import java.io.IOException;
  
  import javax.servlet.ServletException;
  import javax.servlet.http.HttpServlet;
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  
  public class TestClient extends HttpServlet {
      private static final long serialVersionUID = 1L;
  
      /**
       * @see HttpServlet#HttpServlet()
       */
      public TestClient() {
          super();
          // TODO Auto-generated constructor stub
      }
  
      /**
       * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
       */
      protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
          response.setContentType("text/json");
          App app = new App();
          app.setAppID(request.getParameter("appID"));
          app.setAppPassword(request.getParameter("appPwd"));     
      }
  
      protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
  
      }
  
  }
  </code></pre>
  
  <p>My App is a simple Java class that has appID, and appPassword with getters and setters, so I am not going to post that here. </p>
  
  <p>My question is - Am I doing this right or 100% wrong? Please give me your advice.</p>