Results 1 to 3 of 3
- 02-04-2011, 11:39 PM #1
Senior Member
- Join Date
- Feb 2009
- Posts
- 117
- Rep Power
- 0
what is the best way to pass around an object in many jsp pages
hi, thanks for reading
just like what is stated above, what would be the best way to pass around an object between jsp pages. specifically, that object would be an ArrayList. it should hold some information that needs to be retrieved over time by a couple of jsp pages.
one way our instructor told us is to put the object in the session object, like
but is it possible to have that array list object be declared in a separate java file and have the arraylist object declared as static? would that be a possible way to pass around an object?Java Code:session.setAttribute(key, 'arraylist object');
any suggestions would be appreciated.
thanks,
simon
- 02-05-2011, 03:04 AM #2
Moderator
- Join Date
- Jul 2010
- Location
- California
- Posts
- 1,608
- Rep Power
- 5
You don't provide enough information to answer this question directly. The solution your instructor gave you would work fine for sharing values between pages in a Session. Each session is a per user basis, so if you want to keep values for a given session set a session attribute. If you have something which needs to be shared across all users and would be considered more of a constant/global than anything else, try using a static.but is it possible to have that array list object be declared in a separate java file and have the arraylist object declared as static? would that be a possible way to pass around an object?
- 02-05-2011, 04:59 AM #3
Senior Member
- Join Date
- Feb 2009
- Posts
- 117
- Rep Power
- 0
Similar Threads
-
pass a variable from one object to another
By kev670 in forum New To JavaReplies: 3Last Post: 11-25-2010, 01:20 AM -
Pass multiple object types to one function
By desmo in forum New To JavaReplies: 3Last Post: 10-08-2010, 07:51 AM -
can i process two web pages at once?
By saurabh208 in forum Java ServletReplies: 2Last Post: 08-25-2010, 09:11 AM -
how to pass an arraylist from an object back to the parent object that it was created
By george_a in forum New To JavaReplies: 1Last Post: 03-04-2009, 06:14 PM -
Getting all the pages from a domain
By eva in forum New To JavaReplies: 0Last Post: 12-25-2007, 11:41 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks