struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Reumann <>
Subject Re: Best practices questions
Date Wed, 18 Jan 2006 02:02:51 GMT
Josh McDonald wrote:

> First of all, is there a site full of patterns and best practices for
> tomcat?

For Tomcat specifically? Not sure.

> Second, here's my specific enquiry: Let's say we've a page where you
> select an item from a list, and then you can perform one of 5 actions on
> it. 
> One is 5 forms with different ".do" destinations, and javascript to
> copy information from the "master form" into these forms and then submit
> them. 
> This doesn't really strike me as elegant.

Nah, don't do that. You are correct, not elegant.

> However the other solution that immediatly springs to mind is some form
> of token (or god forbid an url or class name) describing what action to
> call embedded in the form, and set with javascript.

Well, I like to use Dispatch actions to keep my related types of 
functionality in one Action class. To use a Dispatch action you simply 
pass a parameter to your Action (as defined in your action-mapping) 
which tells the Action which actual method to call.

> The problem with this, is it moves the "which class file to call to do
> an action" decision is moved out of the struts-config.xml, into either
> the jsp (in the case of the url/class name), or into some "wrapper"
> servlet in the case of the token.

Not really sure what you mean there since you can simply have different 
mappings which 'where they actually go to' is defined in the 
struts-config. I think you need to clarify a bit if we are talking about 
form submissions with a form tag or clicking on URL. Either way, I still 
use a DispatchAction to hold related functionality in one Action class.

You might want to take a look at a full example that mimics CRUD 
functionality (create,update,delete) and uses a Dispatch action. Some functionality in that 
example is called from an URL others from a form submit.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message