Finally a question I can answer!

Below is my code to do what you want. The value of the button pressed
will be stored in the bean's submit variable (which you must create).
The bean:message tag is there so that the button's title will be set
according to the locale setting. app.submit, app.renew, and app.replace
refer to the application resource file(s).

J.

          <html:submit value="submit" property="submit">
            <bean:message key="app.submit"/>
          </html:submit>
          <html:submit value="renew" property="submit">
            <bean:message key="app.renew"/>
          </html:submit>
          <html:submit value="replace" property="submit">
            <bean:message key="app.replace"/>
          </html:submit>

-----Original Message-----
From: Thomas Sundberg [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, July 26, 2005 10:53 AM
To: 'Struts Users Mailing List'
Subject: Which button was pressed?

Hi!

I have a form where a user should be able to request a report. The user
enters two dates and then presses either a button labeled pdf, html och
csv.
How can I read in my action which button was pressed?

My form looks something like this:

The button part of my form looks something like this:

<html:submit value="pdf"
               alt="Create a pdf file"/> <html:submit value="html"
               alt="View report as html online"/> <html:submit
value="csv"
               alt="Create a tab separated text file for import in
Excel"/>

I haven't seen any good examples when looking in the docs and searching
the web. I assume I wan't to add something to the html:submit, perhaps
use the property tag(?), or can I be able to read the value of the
button pressed?
How do I read the value in my action?

/Thomas


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


-- 
This transmission is intended only for use by the addressee(s) named herein and 
may contain information that is proprietary, confidential and/or legally 
privileged. If you are not the intended recipient, you are hereby notified that 
any disclosure, copying, distribution, or use of the information contained 
herein (including any reliance thereon) is STRICTLY PROHIBITED. If you received 
this transmission in error, please immediately contact the sender and destroy 
the material in its entirety, whether in electronic or hard copy format. Thank 
you.



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

Reply via email to