You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by BinhMinh Nguyen <st...@yahoo.com> on 2001/07/18 21:02:06 UTC

Begginer: how do i know what button is clicked from a strut form

I am new to struts and got stuck.

Please anyone tell me how do i know what button is
clicked to detect the event from a strut:form.
For example, my form have three buttons: OK, RESET,
CANCEL, I would like to perform tasks that are
associated with these button, but I dont know how to
detect what button is clicked.

Please give me example if possible thank you

BM Nguyen

__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/

Re: Begginer: how do i know what button is clicked from a strut form

Posted by William Jaynes <wj...@mediaone.net>.
If your jsp has a submit tag like:

<shtml:submit property="OK" value="Press Here if OK"/>

then your Action would contain something like

String okButton = request.getParameter("OK");
    if (null != okButton) { ...code... }

However, RESET and CANCEL are generally something different. A standard reset
button is handled by the browser. The standard cancel button can be detected by
a call to isCancelled(request).

Will


----- Original Message -----
From: "BinhMinh Nguyen" <st...@yahoo.com>
To: <st...@jakarta.apache.org>
Sent: Wednesday, July 18, 2001 3:02 PM
Subject: Begginer: how do i know what button is clicked from a strut form


> I am new to struts and got stuck.
>
> Please anyone tell me how do i know what button is
> clicked to detect the event from a strut:form.
> For example, my form have three buttons: OK, RESET,
> CANCEL, I would like to perform tasks that are
> associated with these button, but I dont know how to
> detect what button is clicked.
>
> Please give me example if possible thank you
>
> BM Nguyen
>
> __________________________________________________
> Do You Yahoo!?
> Get personalized email addresses from Yahoo! Mail
> http://personal.mail.yahoo.com/