Link to home
Start Free TrialLog in
Avatar of letsbedecent
letsbedecent

asked on

Struts Forms question

Hello,

      Today a guy asked me if i could map one action to two forms !!  

      Can we do that ?? He says the first forms information he will store in the session, and then on the second form when the user will submit the form, he will store the two forms into the database. How can he store a forms information in session ?????????????????  

Thanks
ASKER CERTIFIED SOLUTION
Avatar of aozarov
aozarov

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of letsbedecent
letsbedecent

ASKER

yeah.. but isnt the information on the first form lost when the user goes to the second page !!! If the form is not associated with an action form ?

Or is he thinking about using request.getParameter() and storing all the information in a session !!
The Form will "live" based on the scope defined in the Action.
e.g
<action
                path="/LogonSubmit"
                type="app.LogonAction"
                name="logonForm"
                scope="request"
                validate="true"
                input="/pages/Logon.jsp">
                <forward
                    name="success"
                    path="/pages/Welcome.jsp"/>
                <forward
                    name="failure"
                    path="/pages/Logon.jsp"/>
            </action>

This Action will create an instance of logonForm per request.
if you change scope="request to scope="session" (which is the default if you don't provide this attribute) then that logonForm will live for the whole session.