> To use LookDispatchAction I must create a subclass that extendsThis is the approach I just took to solve the same problem. I ran into this because the same page needs to prepopulate the form, so I want to go through the action instead of just going directly to the jsp. it would be nice if LookupDispatchAction.execute() would call a default execute method in the case that the parameter is missing.
> LookDispatchAction, isn't it ?
> Are there disadvantages to use LookDispatchAction ?
The only one I've found is that it will blow up if the "parameter" you
specify is not in the request. It's an easy fix-- I posted my code last
week. Just override 'execute' and provide a default behavior if the
parameter is null, otherwise call super.execute() and let the existing code
deal with it.
I am just starting on my first struts project, so please excuse (and correct) me if I am confused about this, but it seems to me that there might be a better way to solve the multiple submit buttons on one form thing. Actually this is really just a thought, more than an actual suggestion for now:
The real reason (I think?) that we need this LookupDispatchAction solution is that the <input type="submit"> html element uses it's "value" as the display name of the button that the user sees. since that will change for users in different locales, the LookupDispatchAction does a reverse lookup on the internationalized string that it receives from the browser, so that you don't have to use that value in your code, you can use the property name that generated the internationalized string in the first place. To me this seems like 99% solution, 1% hack, because it is still actually using the display name of the submit button (an internationalized string) as the value that determines which method to call. (what if two of your properties have the same value? unlikely of course, but theoretically possible, and it would cause a problem)
But wouldn't the best solution be to use the html <button> tag instead of <input type="button">, and then using a normal DispatchAction? (or an Action with a switch on the value of a parameter).
http://www.w3.org/TR/html4/interact/forms.html#h-17.5
I guess one reason not to do this is that it restricts browser support (do any relatively new browsers *not* support button? it's part of the html 4.01 standard)
For example, the html would look like this:
<button type="submit" name="action" value="add">add a new item</button>
<button type="submit" name="action" value="remove">remove the selected item</button>
<button type="submit" name="action" value="modify">modify the selected item</button>
The most obvious reason not to do this I guess is that the struts html tags don't generate a <button> tag, the html:button tag generates an <input type="button">, so the html <button> tag would need to be hardcoded in the jsp file like this:
<button type="submit" name="action" value="add"><bean:message key="button.addnew"/></button>
Any thoughts? Will the struts html taglibs start using the html <button> tag anytime in the future?
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>