Struts: passing object in session scope

I want to pass an object in the scope of the session. I want to set this in the struts action class. I am using request.setAttribute ("obj", objval) to pass a value in the request scope. how can i get through the session i need to do anytnig in the struts-config file? there is some parameter scope in the struts-action. Did he get anything to do with it? is there a built-in thing in struts for this?

0


a source to share


1 answer


pass object in session scope:

request.getSession () SetAttribute ("OBJ", objVal) ;.



struts automatically places objects in a request or session using the parameter attribute in the struts action file. Then, if you are using the stuts: html tag library, forms using that tag library will be populated. For more information, see the struts class for ActionForm.

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

+1


a source







All Articles