title: JSP request is not pass to another jsp page when using jquery load method
body: <p>I encountered a problem when using jquery's load() method in JSP page. In the first page, I am trying to set attribute list1 into request and use load() to load contents of page 2 into page 1's "#content".</p>
  
  <pre><code>&lt;% 
      ArrayList&lt;String&gt; list1 = new ArrayList&lt;String&gt;();
      request.setAttribute("list1", list1);
  %&gt;
  
  &lt;script&gt;
      (function($) {
          $(document).ready(function() {
              $.ajaxSetup( {
                  cache: false,
                  beforeSend: function() {
                      $('#RSSList').hide();
                      $('#loading').show();
                  },
                  complete: function() {
                      $('#loading').hide();
                      $('#RSSList').show();
                  },
                  success: function() {
                      $('#loading').hide();
                      $('#RSSList').show();
                  }
              });
              var refreshId = setInterval(    
                              function() { 
                                $("#content").load("page2.jsp");
                              }, 9000); 
          } );
      })(jQuery);
  &lt;/script&gt;
  
  &lt;div id="content"&gt;&lt;/div&gt;
  &lt;img src="images/loading.gif" id="loading" alt="loading" style="display:none;" /&gt;
  </code></pre>
  
  <p>In second page, list1 is being retrieved from request and do some processing before being output by out.println()</p>
  
  <pre><code>&lt;% 
      ArrayList&lt;String&gt; list2 = (ArrayList&lt;String&gt;) request.getAttribute("list1");
  
      // process list2 here
  
      if (list2==null){
          out.println("list2 is null");
      } else {
          // out.println() contents of list2
      }
  %&gt;
  </code></pre>
  
  <p>Then here is where the problem lies. <code>request.getAttribute("list1")</code> in page 2 returns null pointer, and after some research I found that request is not being sent to page 2 so I cannot retrieve "list1" from request.</p>
  
  <p>I cannot use <code>request.getRequestDispatcher("page2.jsp").forward(request, response)</code> in page 1 as it will redirect me to page2.jsp, that is not what I intended to do.</p>
  
  <p>Is there any work around that I can pass request to page 2 so that I can retrieve list1 in page2.jsp? Thanks.</p>