wood burning stoves 2.0*
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 OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA 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: 375
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: 375
I found out the problem. I used "protected" method by mistake. so it did not work. changed it to public and it worked. thanks.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: s:submit