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
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.
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.
ASKER
Or is he thinking about using request.getParameter() and storing all the information in a session !!