• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Getting the arraylist through session

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello frnds...

I am putting the array values in session....but when i getting the array in jsp i am getting only last value......not the full array.

code is as follows:



jsp page where i am getting the session.....

 
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Don't use scriplet in jsp, rather JSTL will be the right way.
The below would be helpful.

ses.setAttribute("AttNameA",AttNameA); //Assuming that you have the at
ses.setAttribute("AttValueA",AttValueA);



As you already have the attributes set into session you can go with JSTL directly.
<c:forEach var="nameA" items="${AttNameA}">
<c: out value="${nameA}"/>
</c:forEach>

 
Bartender
Posts: 1845
10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is also an issue with your code.
The session attribute is set from the methd: "writeDocumentToOutput" .
This method is called recursively.
Every time you call the method it is setting the session attributes, and overrides the previous value it had.

That explains why you only get the "last" value.
This class looks like it was written for an app, and is being adapted for the web.

What is it you are trying to accomplish in the display?
 
Just let me do the talking. Ahem ... so ... you see ... we have this tiny ad...
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic