tags:

views:

538

answers:

1

i want to pass a object in session scope. i want to set this in struts action class. i use request.setAttribute("obj",objval) to pass value in request scope. how do i pass in session scope do i need to do anytnig in struts-config file? there is some parameter scope in struts-action file .has it got anythinh to do with that? is there any inbuilt thing in struts to do this?

A: 

to pass on object in session scope:

request.getSession().setAttribute("obj",objVal);

struts will automatically put objects into a request or session by using the parameter attribute in the struts-action file. Then, if you are using the struts:html tag library, forms using this tag library will populate themselves. For more info, see the struts class for ActionForm.

But to place an object directly into the session yourself, you can use the code above.

adam