title: How can I use Gson here to send back the list to the jsp page?
body: <p>In one case a <code>servlet A</code> sends an IP to a remote server with the hope that the server will send back the list of files shared by that IP :</p>
  
  <pre><code>Servlet A
  
  connection.openConnection(); // Sends the IP as the query parameters
  if(connection.getResponseCode() == 200) {  
      requestDispatcher.forward(request,response); // Forward to ShowFiles.jsp
  } else { // Error ! }
  </code></pre>
  
  <p><em><strong>Note: 'ShowFiles.jsp' is a jsp page that will show the list it will receive from the server.</strong></em></p>
  
  <p>Okay ! Now the <code>servlet</code> on the server,let us name it <code>B</code>, receives the query parameter and checks if the database has any file corresponding to the IP received. If there is/are files shared it sends back the list of names,otherwise a message suggesting that no file has been shared.</p>
  
  <pre><code>Servlet B (On server that receives IP as query parameter)
  
  String ip = getAttribute("IP");
  if( hasSharedFile(ip) ) {
    list = fetchList(ip); // Basically an ArrayList&lt;String&gt;
    // SEND THIS LIST BACK TO THE CLIENT
  } else {
     // Return a message saying,No file has been shared till with the server
    }
  </code></pre>
  
  <p>To send this list by the <code>servlet B</code> <em>(on the remote server)</em> to <code>ShowFiles.jsp</code> <em>(to which the servlet A dispatched the request)</em> I was suggested to use <code>JSON</code>,rather <code>Gson</code>. How can I use <code>Gson</code> to send this list to <code>ShowFiles.jsp</code> ?</p>
  
  <p>I have never used Gson,so I know nothing.</p>