• Post Reply Bookmark Topic Watch Topic
  • New Topic

Getting the arraylist through session

 
jyoti mahajan
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • 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.....

 
dileep keely
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • 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>

 
Stefan Evans
Bartender
Posts: 1822
10
  • Mark post as helpful
  • send pies
  • 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?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!