File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes s:submit Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "s:submit" Watch "s:submit" New topic
Author

s:submit

ben oliver
Ranch Hand

Joined: Mar 28, 2006
Posts: 374
I have a JSP form like

<s:form action="saveInfo" method="post" theme="simple">
......

<tr>

<td>
<s:submit theme="simple" value="Save" action="saveInfo" name="submit"></s:submit>
<s:if ...>
<s:submit theme="simple" value="Delete" action="deleteInfo" name="delete"></s:submit>
</s:if>
</td>
</tr>
..
</s:form>


So I have two submit type buttons here. One is for "Save" and the other is for "delete", each has a different action name. I have defined the action mapping in struts.xml file. What I found is -- when I click the "delete" button, the url shows "../saveInfo", which is weird (it is supposed to show ../deleteInfo). but, but the almost blank screen shows a message like

com....action.DeleteInfo

In strust.xml mapping I map "deleteInfo" to this class . So it seems it called that class, then why the URL shows "saveInfo" ? Plus, when I use debug, it doesn't reach the "DeleteInfo" class.

Is there anything wrong here ?

Thanks.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Is there anything in the logs? What does the configuration look like?

Oh, and please UseCodeTags.
ben oliver
Ranch Hand

Joined: Mar 28, 2006
Posts: 374
I found out the problem. I used "protected" method by mistake. so it did not work. changed it to public and it worked. thanks.
 
 
subject: s:submit
 
Similar Threads
Struts 2 checkboxlist error - list key could not be resolved
problem running dojo.plugin in struts2.1.6
Need help in getting check box values
editing cells in table - not working
[Struts2] losing display only(prepopulated) values of the form if the validaiton fails