You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Kevin HaleBoyes <kz...@yahoo.com> on 2002/12/03 16:30:50 UTC

html:submit question

I have a couple of <html:submit> elements on one <html:form>.
How do I distinguish between the different buttons?

Specifically, I have

 <html:submit property="operation">Edit Loan</html:submit>
 <html:submit property="operation">Reject Loan</html:submit>

The form bean has a setOpereration(String) setter method which
is called with the text of the button (ie, "Edit Loan")
when the form is submitted.

When I look at the HTML that is rendered in the browser, I see that
the property attribute becomes the "name" attribute of the <input>
element.

The way it works now, I have to compare the value of the operation
property of the form bean against the string that is displayed to
the user.  That seems a bit fragile - suppose the customer wants the
"Reject Loan" to be "Cancel Loan" instead.  I'd have to change code
in my action to effect the change.

I'm looking for an attribute to <html:submit> that is the value that
gets set to the property (operation).  Is there such a thing.

I want to avoid having a different form-bean-attribute for each
submit tag (like operation1, operation2, etc.).

Thanks,
Kevin.


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: html:submit question

Posted by Kevin HaleBoyes <kz...@yahoo.com>.
--- Gemes Tibor <ge...@regens.hu> wrote:
> 2002. december 3. 16:30 d�tummal Kevin HaleBoyes ezt �rtad:
> 
> > The way it works now, I have to compare the value of the
> operation
> > property of the form bean against the string that is displayed to
> > the user.  That seems a bit fragile - suppose the customer wants
> the
> > "Reject Loan" to be "Cancel Loan" instead.  I'd have to change
> code
> > in my action to effect the change.
> 
> Use LookupDispatchAction then. 

Wonderful!  That is it exactly!
Thanks

> Tib

Kevin.


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: html:submit question

Posted by Gemes Tibor <ge...@regens.hu>.
2002. december 3. 16:30 dátummal Kevin HaleBoyes ezt írtad:

> The way it works now, I have to compare the value of the operation
> property of the form bean against the string that is displayed to
> the user.  That seems a bit fragile - suppose the customer wants the
> "Reject Loan" to be "Cancel Loan" instead.  I'd have to change code
> in my action to effect the change.

Use LookupDispatchAction then. 

Tib

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>