This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Collection on jsp

 
fahad siddiqui
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I get an arraylist from the action on the jsp to display.
now i again want to set the arraylist into action and then submit the page, so that i can again fetch the same arraylist from the request in the action class.

What are the possibilities?

Please advise.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Put the arraylist into the session.
 
fahad siddiqui
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to accomplish this without the use of session.
Ne ideas?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64844
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Ne" is not a word. Please use real words when posting.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This sucks, but you could put the values into hidden parameters.
But you have to separate values with something, like commas, which can be troublesome if some of the values already hold the separator.

<input type="hidden" name="myarray" value="one,two,three"/>
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by fahad siddiqui:
I want to accomplish this without the use of session.
Any ideas?


Why?
 
Makarandp Parab
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What don't you set the Arraylist object in the Request object. Like request.setAttribute("data", arrobject).

Let me know if it works for you.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Makarandp Parab:
What don't you set the Arraylist object in the Request object. Like request.setAttribute("data", arrobject).

Let me know if it works for you.


The request object is only good for the duration of one 'request'.
The original poster indicated that he wants to be able to retrieve the data after submitting the current page.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64844
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Makarandp Parab:

Let me know if it works for you.


I can answer that. It won't. Please don't waste people's time suggesting things that you don't know will work or not.
 
Prabhu Venkatachalam
Ranch Hand
Posts: 502
Java jQuery Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I get an arraylist from the action on the jsp to display.
now i again want to set the arraylist into action and then submit the page, so that i can again fetch the same arraylist from the request in the action class.

What are the possibilities?


You want have an object(ArrayList) along mutiple request. for a particular client?

Possibilities:

1. HttpSession - If it is for particular client.
2. ServletContext - If it for whole application.
3. hidden variable - You can have a hidden variable which will values which arraylist is having and pass it on every request to the action class.In Action class recreate arraylist with this values. but this ugly way of doing.
4. Using Database.

Better to use session or context.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic