If you need to change the action of the form, you can do this in the onclick
event : 

document.formName.action = "/delete.do"  

If you change the action, you probably won't need the method parameter then.

Be sure that you do not have an element in your form called 'action',
otherwise it will confuse Internet Explorer.

-----Original Message-----
From: victor gusz [mailto:[EMAIL PROTECTED] 
Sent: Friday, September 12, 2003 14:04
To: Struts Users Mailing List
Subject: RE: newbie question: how to handle two dispatchAction methods in a
jsp page?


Hi, Jerome:

Thanks for helping. 

I tried out your code. Strangely, if I click on either
save button, or delete button, now they both forward
to
save page. It seems action still forwards to save
method
even I clicks on delete button.

Any idea?

regards,



--- Jerome Devost <[EMAIL PROTECTED]> wrote:
> Hi Victor,
> 
> If you have both <html:hidden property="method"/>
> and buttons in the same
> form, both method are submitted when you pressed
> either button. You could
> change the value with javascript code before
> submitting the form. Something
> like this might work :
> 
> <html:hidden property="method" value="save"/>
> <html:submit>
>   <bean:messagekey="button.save"/>
> </html:submit>
> 
> <html:submit onclick="document.formName.method.value='delete'">
>   <bean:message key="button.delete"/>
> </html:submit>
> 
> 
> 
> -----Original Message-----
> From: victor gusz [mailto:[EMAIL PROTECTED]
> Sent: Friday, September 12, 2003 13:33
> To: [EMAIL PROTECTED]
> Subject: newbie question: how to handle two
> dispatchAction methods in a jsp
> page?
> 
> 
> Hi, guys:
> 
> I have two methods in a DispatchAction class: save,
> delete
> 
> and I have two buttons in a jsp page: save, delete.
> 
> In order to successfully save and then forward to
> another
> page, I can do the following:
> 
> <html:submit><bean:message
> key="button.save"/></html:submit>
> <html:hidden property="method" value="save"/>
> 
> This works fine. But if I add code related with
> delete
> method just following the above code: <html:submit><bean:message
> key="button.delete"/></html:submit>
> <html:hidden property="method" value="delete"/>
> 
> Everything fails.
> 
> I am wondering how I can handle multiple
> DispatchAction methods in a jsp page?
> 
> regards,
> 
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free, easy-to-use web site
> design software
> http://sitebuilder.yahoo.com
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to