Struts Forms question

Posted on 2005-04-26
Last Modified: 2010-03-31

      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 ?????????????????  

Question by:letsbedecent
    LVL 15

    Accepted Solution

    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).

    Author Comment

    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 !!
    LVL 15

    Expert Comment

    The Form will "live" based on the scope defined in the 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.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    Suggested Solutions

    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…
    Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
    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 about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…

    760 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

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now