Results 1 to 4 of 4

Thread: My JSP page contains two submit button "next" and

Hybrid View

  1. #1
    Join Date
    Aug 2005
    Posts
    12

    Default 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. #2
    Join Date
    Nov 2004
    Location
    Austin, Texas USA
    Posts
    46

    Default Re: My JSP page contains two submit button "next"

    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

  3. #3
    Join Date
    Aug 2005
    Posts
    12

    Default It is working

    Thank u very much

  4. #4
    Join Date
    Sep 2004
    Location
    Leuven, Belgium
    Posts
    1,853

    Default

    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 at 08:35 PM.

Similar Threads

  1. Replies: 8
    Last Post: Oct 30th, 2012, 11:33 AM
  2. Replies: 9
    Last Post: Apr 24th, 2007, 06:59 AM
  3. Pageable data list with Hibernate
    By robmorgan in forum Data
    Replies: 23
    Last Post: Jul 24th, 2006, 06:12 PM
  4. Two submit button with two captions
    By vijayan in forum Web Flow
    Replies: 1
    Last Post: Aug 26th, 2005, 01:24 AM
  5. Replies: 1
    Last Post: May 16th, 2005, 08:48 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •