struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Johnson nickel <sarava...@elogic.co.in>
Subject Multiple submit buttons in a single JSP
Date Thu, 07 Feb 2008 13:40:33 GMT

Hi all,

      In my JSP, i have three submit buttons, i want to know which button
user has clicked.

 I tried from this site, 
http://struts.apache.org/2.x/docs/html-form-buttons-howto.html 
http://struts.apache.org/2.x/docs/html-form-buttons-howto.html  
It's not working. 

            Give me some ideas,  i have added my code,


      public String execute() {
        if (buttonOnePressed) {
            message = "You pressed the first button";
           Save();
         
        } else if (buttonTwoPressed) {
            Update();
            message = "You pressed the second button";
        } 

        else if (buttonThreePressed) {
           Show();
            message = "You pressed the second button";
        } 
        else {
            return ERROR;
        }
        return SUCCESS;
    }

 In My Struts.xml file,

<action name="user_details2" class="com.user_details">
            <result  name="input">/JSP/user_details.jsp</result>  
			<result name="success">/JSP/user_details.jsp</result>
			<result name="error">/JSP/user_details.jsp</result>
			
		</action>

In Jsp,

 <input type="submit" name="buttonOnePressed" value="Save"/> 
<input type="submit" name="buttonTwoPressed" value="Update"/> 
<input type="submit" name="buttonThreePressed" value="Show"/> 
-- 
View this message in context: http://www.nabble.com/Multiple-submit-buttons-in-a-single-JSP-tp15334087p15334087.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message