• 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:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Replacement for Session Object in Struts Action Class  RSS feed

 
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am working with struts In my action class I am getting a Collection of EmployeeName and then I am setting this in Session and displaying it in my JSP page in this way..
/*****************************
Collection employeeName= getEmployeeName(empForm, req, res);
if (employeeName != null) {
session.setAttribute( "departmentListAll",departmentList);
}
*****************************/

I want some other way to pass my Collection(employeeName) Object to my jsp page,As session might will be overloaded if I set all Objects in session.

Please write your suggestion I know I can use request Object but it will be lost after request.

I am calling my EJB methods in my Action Class only.
 
P K
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

Couldn't u use set the collection in the request
In that way the collection would be available only till the request and wouldn't be residing in the session ..

hope this helps
PK
 
P K
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry hadn't read ur entire post ..

If u need ur collection to be alive more than the request , the solution would be session .. what u could do is clear the session once u are doen with the collection a way out can be intercepting your requests and clearign the session ..
In any case u would need to put ur object in session for it to be available more than the request..
 
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try using SFSB. There by you will be keeping data at the server side and you can set data at the request scope for displaying in JSP.

I know this is not a struts solution, but i feel this is a good soln.

- Prasanna B.P
 
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If departmentListAll values do not change, you can place them in application scope. That way you only deal with one copy and one reference.

Another thing to keep in mind is that if all of the sessions hold a reference to the same list, then there is still only one copy of the list and this will not put a huge load on your server.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!