Win a copy of Microservices in Action this week in the Web Services forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

Collection on jsp  RSS feed

 
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.
 
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?
 
Marshal
Posts: 67165
169
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"/>
 
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?
 
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
Marshal
Posts: 67165
169
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.
 
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
Boost this thread!