> buttons.add & buttons.delete have to be defined, which is not obvious for
somebody
> who does not take care about internationalization. In fact I would define
the
> resources in any case. But what about images ? How do you want to handle
them ?

For images I would put the image name in ApplicationResource.properties and
use <html:image srcKey="..."/> - but I probably wouldn't go to that extreme
until localization is needed.

> Sure. It is a matter of taste. But perhaps not only. What would happen if
one
> day someone decides to move 2 from 5 submit buttons to another page ? Will
you
> rewrite the class ?

If buttons move from one page to another  you'd have issues in your design
as well, unless each page is pointing to the same action - right?

It is likely in our application that buttons will be enabled/disabled (by
logic in the JSP to conditionally output them).  I would have to see a more
concrete example of moving buttons from one page to another, as that has
many other implications - is it a single ActionForm multi-page wizard-like
form?  If not then why would buttons move from one action to another?

> Single action are also helpful, if you want to call them from several
places,
> say from context-menu or even through short cuts. I prefer to have all
actions
> defined in separate classes. But this is just my preference and I accept
> another solutions.

Understandable - and could be accomplished in my design by having the
dispatch go to methods, which then delegated its  handling to another action
class.  I certainly do not advocate the same code in multiple places!  :)


>>         // Go back to input (any other ideas ?)
>>         return new ActionForward(mapping.getInput());

>Ideas - How about returning ActionErrors if the mapping isn't found?  Or I
>personally would throw a JspException since this is truly a situation that
>cannot be handled wisely by the action in all cases and represents a
>situation that should not happen.

Yes. Throwing exception would be really better.

>In your design, struts-config.xml will have to be modified if a designer
>switches between using a graphic button and text buttons by adding or
>removing the ".x", or as in your example, name text buttons with ".x" on
>them - which I don't prefer.  My goals are to make the designers life as

I see no harm in this ".x" suffix, especially if you work with images.
But it is not the most nice in design for sure.

>>I don't think using DispatchAction as you suggest will work.  What it
>>would do in the "add" case is this:
>>- call request.getParameter("add") - what would that return in your case?

> Sure. It won't work if you don't add ".x" suffix ;-)

I think there is a misunderstanding here about DispatchAction.
request.getParameter("add.x") would return the coordinates where the user
clicked (if it was an <html:image>.  Then DispatchAction would try to find a
method by that name - and I definitely don't think you'll name methods for
each X-coordinate for an image! :)

DispatchAction dispatches to the method named by the result of getParameter,
and gets the parameter name from struts-config.  Another level of
indirection is what is accomplished by my LookupDispatchAction (and your
first solution).

So, where does that leave us with the variants of DispatchAction?  Besides
Dmitri's feedback, anyone else have opinions on it?

    Erik



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

Reply via email to