Announcement Announcement Module
Collapse
No announcement yet.
My JSP page contains two submit button "next" and Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • My JSP page contains two submit button "next" and

    I have a jsp file (enterAddress.jsp") which contain two submit buttons with

    different captions like below:

    <input type="submit" name="next" value="next"/>
    <input type="submit" name="back" value="back"/>

    And My web-flow.xml is given below:

    <view-state id = "enterAddress" view = "enterAddress">
    <transition on="submit" to="displayData">
    <action bean="multiPageFormAction" method="bindAndValidate" />
    </transition>
    <transition on="back" to="enterName">
    <action bean="multiPageFormAction" method="bindAndValidate" />
    </transition>

    </view-state>

    In this web-flow.xml "dispalyData" and "enterName" are two jsp files...
    On clicking "next" button i want to display "displayData.jsp"
    and on clicking "back" button i want to display "enterName.jsp".

    My problem is:
    Here whether i click the "next" button or "back" button the same page
    is coming (disPlayData.jsp). I need the "enterName.jsp" if i click
    the back button.......For this whatever changes i needed in
    "enterAddress.jsp" and "web-flow.xml"????????

  • #2
    Re: My JSP page contains two submit button &quot;next&quot;

    I believe SWF interprets a form submission as a submit event. This can be overridden by providing an explicit '_eventId' value in your form post. There are a few finer points with which you should be familiar.

    Naming a submit button '_eventId' means that you must provide the desired event id as the button value. This often doesn't make for a very good button name. Also, multiple submit buttons named '_eventId' will cause a problem when you submit your form. Naturally, SWF will not handle two events in one request.

    Try this instead:
    Code:
    <input type="submit" name="_eventId_next" value="Next"/> 
    <input type="submit" name="_eventId_back" value="Back"/>
    You also need to change your transition:
    Code:
    <view-state id = "enterAddress" view = "enterAddress"> 
         <transition on="next" to="displayData"> 
              <action bean="multiPageFormAction" method="bindAndValidate" /> 
         </transition> 
         <transition on="back" to="enterName"> 
              <action bean="multiPageFormAction" method="bindAndValidate" /> 
         </transition> 
    </view-state>
    Hope that helps.
    -Alex

    Comment


    • #3
      It is working

      Thank u very much

      Comment


      • #4
        Vijayan,

        Also see your question here: http://forum.springframework.org/showthread.php?t=17571.

        Please do not post the same question twice!

        Erwin
        Last edited by robyn; May 14th, 2006, 08:35 PM.

        Comment

        Working...
        X