Another solution if you don't want to use javascript, is to rely on the
fact that the name and value atrributes of the submit button that was
pressed are passed through the http request. The values for the other
submit buttons aren't sent. So in your action you check for the existance
of each submit buttons name to figure out which button the user pushed.
So if you have the following submit buttons in your jsp file
SAVE
CANCEL
Then in your action you can do something like this:
String saveAction = request.getParameter("save");
String cancelAction = request.getParameter("cancel");
if (saveAction != null) {
doSave();
} else if (cancelAction != null) {
doCancel();
}
On Wed, 29 Oct 2003 14:24:54 -0600, [EMAIL PROTECTED] said:
> for ur question 2:
>
> you can use javascript function to call two different action:
>
> function faddpurpose() {
> document.editform.methodtocall.value = "addpurpose";
> document.editform.forwardpage.value = "totalsuccess";
> document.editform.target="_self";
> document.editform.submit();
> }
>
> function fcalculatepaypd() {
> document.editform.methodtocall.value = "calculatepaypd";
> document.editform.forwardpage.value = "totalsuccess";
> document.editform.target="_self";
> document.editform.submit();
> }
> type="aaa.ers.struts.forms.RecordsForm">
>
> so U can create a dispatch action and call two different action changing
> value for methodtocall.If you are not using dispatch action then just set
> your forms action to whatever action U want to go to..
>
>
>
>
> "ZYD" <[EMAIL PROTECTED]>
> 10/29/2003 01:18 AM
> Please respond to "Struts Users Mailing List"
>
>
> To: "Struts Users Mailing List"
> <[EMAIL PROTECTED]>
> cc:
> Subject:Help please -- How to provide a "Back" button?
>
>
> Dear all,
>
> Question 1:
>
> How to provide a Back button on a page?
>
> Is there a html tag like the one for Cancel button: ?
>
> Question 2:
>
> How to provide two submit buttons on one JSP page,
> when click on the 1st button, the page is submitted to 1st action,
> when click on the 2nd button, it's submitted to 2nd action?
>
> Any response will be appreciated.
> Thanks.
>
> bruce
>
-o- -o- -o- -o- -o-
ishmael.riles
brnr.tech
510.543.6109
-o- -o- -o- -o- -o-
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]