File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Replacement for Session Object in Struts Action Class

 
Anurag Mishra
Ranch Hand
Posts: 121
  • 0
  • 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
  • 0
  • 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
  • 0
  • 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..
 
Prasanna Puttappa
Ranch Hand
Posts: 54
  • 0
  • 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
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • 0
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic