title: How to update session.setAttribute(name,value) value, where the name is same?
body: <p>I have a situation where I need to update the value of a setAttribute where the name remains same. Consider the following situation as example-<br/>Suppose I have three JSP: abc.jsp, xyz.jsp, pqr.jsp. Now at first abc.jsp runs then control forward to xyz.jsp &amp; then forward to pqr.jsp. Now after execute pqr.jspthe control back to xyz.jsp again with a updated value at setAttribute.<br/>
  <strong>abc.jsp:</strong><br/></p>
  
  <pre><code>ArrayList&lt;Books&gt; getSupplyStatus=new ArrayList&lt;Books&gt;();
  JavaBean javaBean=new JavaBean();
  session=request.getSession(false);
  getSupplyStatus=javaBean.getSupplyStatus(memberID); //It returns a ArrayList 
  if(!getSupplyStatus.isEmpty())
  {
    session.setAttribute("UpdatedBooklist", getSupplyStatus);
    request.getRequestDispatcher("xyz.jsp").forward(request, response);
  }
  </code></pre>
  
  <p><strong>xyz.jsp:</strong><br/></p>
  
  <pre><code>session=request.getSession(false);
  ArrayList&lt;Books&gt; getSupplyStatus=(ArrayList&lt;Books&gt;) session.getAttribute("UpdatedBooklist");
  // some operations &amp; forward to pqr.jsp
  </code></pre>
  
  <p><strong>pqr.jsp:</strong><br/></p>
  
  <pre><code>// in this jsp new ArrayList&lt;Books&gt; will be prodeuced
  // &amp; I need to bound the value of "UpdatedBooklist" with 
  // which is set in abc.jsp,
  // and previous value must be override &amp; then forward to xyz.jsp again
  // In xyz.jsp we recieve the updated value.
  </code></pre>