title: Pass JSONObject to JSP and print the data
body: <p>In servlet im creating a JSONObject and passing that object to JSP.</p>
  
  <pre><code>JSONObject jo=new JSONObject();
  jo.put("site","java4s.com");
  jo.put("content","Java");
  jo.put("TotalLinks",927);
  HttpSession session=request.getSession(true);
  session.setAttribute("jsonObject", jo);
  RequestDispatcher rd = request.getRequestDispatcher("viewpage.jsp");
  rd.forward(request, response);
  </code></pre>
  
  <p>And this is my JSP Page</p>
  
  <pre><code>&lt;%@page import="com.google.gson.JsonObject"%&gt;
  &lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1"
      pageEncoding="ISO-8859-1"%&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=ISO-8859-1"&gt;
  &lt;title&gt;View Json&lt;/title&gt;
  &lt;%
  JSONObject jsonObject=(JSONObject)session.getAttribute("jsonObject");
  %&gt;
  
  &lt;/head&gt;
  &lt;body&gt;
  &lt;h6&gt;JSON View&lt;/h6&gt;
  &lt;br&gt;
  &lt;%=jsonObject%&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>But JSP page showing error that <strong>JSONObject</strong> cannot be resolved to a type. But i have added the jar file and in Servlet it is not showing error. What should I do? Thanks</p>