How to pass a session from an Action class to another class
Joined: Dec 14, 2006
Hi everybody, I am developing a web application with Struts. I have a form where the user inserts some values and in Action class I create the query to get the results from a database. When I submit the form I get a table with these results. Now I want to make some chart with these results on the table. I am using Cewolf for this purpose. To make the chart I must develop a Java class where I need to create the same query that I have in the Action class. For this reason,I saved all the parameters in the form in a session in my Action class. Now in the class to make the chart I must call the session that I saved previously. And for the moment,I am getting errors.So,how to get the session from the Action class in my new class for the charts? I need a fast answer if it is possible. Thanks in advance for this. Mattia
Joined: Feb 08, 2006
I am not 100% sure what you are asking. If you need to get at the session from an Action, you just use the getSession() method of the request passed into the execute method. If you need to get at a form saved on the session, I believe that you need to call request.getSession().getAttribute("FORM") where "FORM" is the name of the form defined in your Action Mapping.