Monkeyden wrote:
If your implementation is similar to what Scott has mentioned (i.e.
different operations on the same type of object), then I consider this a
classic example of a DispatchAction, where type of business entity
doesn't
change...just the selected operation on the business entity, thus it
makes
sense to have it in the same action.
So I'm trying to figure this out myself. I don't actually have multiple
buttons in a single form, but I'd like to know the solution to this if I
run across it in the future... so here's an example:
<form-bean name="myForm" class="mypkg.MyForm" />
<action path="/myAction" type="mypkg.MyAction" name="myForm"
scope="request" validate="false" parameter="action">
<forward ..... />
</action>
OK and then here's my form:
<html:form action="/myForm">
<input type="submit" name="action" value="Create">
<input type="submit" name="action" value="Update">
</html:form>
Now... two things:
- I used HTML because I can't find a way to get Struts to let me name
the buttons with <html:submit>.
- When the form is submitted, let's say the user clicked the "Create"
button. The action will end up with action=Create, which will hit my
DispatchAction method's Create method.
Is this the right way of doing things? It seems kind of weird, because
now you can't do internationalization (buttons always have to be the
same), and you're pretty restricted with what you can name your buttons
and call your DispatchAction's methods.
Ideas?
- Scott
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]