struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Johnson nickel <>
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,  
It's not working. 

            Give me some ideas,  i have added my code,

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

        else if (buttonThreePressed) {
            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>

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:
Sent from the Struts - User mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message