Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Struts Forms question

Posted on 2005-04-26
3
Medium Priority
?
183 Views
Last Modified: 2010-03-31
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
0
Comment
Question by:letsbedecent
  • 2
3 Comments
 
LVL 15

Accepted Solution

by:
aozarov earned 2000 total points
ID: 13870774
An Action is associated with only one ActionForm.
You can store as many objects as you want in the Session. hence your action can create beans and add them to your session (but that has nothing to do with the above).
0
 

Author Comment

by:letsbedecent
ID: 13870805
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 !!
0
 
LVL 15

Expert Comment

by:aozarov
ID: 13870877
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.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Suggested Courses
Course of the Month14 days, 21 hours left to enroll

577 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question