struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Turbine style multiple method actions
Date Thu, 07 Feb 2002 10:43:11 GMT

I'm just trying to catch up with what's changed in struts 1.0.1 / 1.1 
from the version I previously used (pre version numbers). Is there a 
facility to map a request to different methods / actions based on a 
request parameter?

For example, if the request contains a parameter "function", can I 
choose the Action that will be invoked, or alternatively, can I invoke 
different methods in the action defined in the form.action URL, based 
on some parameter? I realise I can change the URL using javascript on 
the html form, but this removes the struts config as the control of app 
flow. In my previous apps, we found theat often you end up writing 
Action classes similar to:

myAction(..) extends Action {

	if (null == function) { doView(..) } 
	else if ("submit".equals(function)) { doSubmit(..) }
	else ...

	prepareRequest(req, ..);
 	return mainPageForward;


Which makes the action into a type of mini controller. I know this 
could be done in a more OO way, but that's not my point, I'd like the 
controller to be able to do this in some way. Turbine does this in a 
very similar way (though I'm not sure I like their parameter 

My only issue with doing this in the main ActionServlet is that 
partioning of the logic should perhaps be encapsulated better -- though 
the XML config file provides a suitable scoping for this information. 

I've not been keeping up with the nightly developments - does the 
"multiple applications", stuff allow this kind of thing?


Visit our website at

This message contains confidential information and is intended only 
for the individual named.  If you are not the named addressee you 
should not disseminate, distribute or copy this e-mail.  Please 
notify the sender immediately by e-mail if you have received this 
e-mail by mistake and delete this e-mail from your system.

E-mail transmission cannot be guaranteed to be secure or error-free 
as information could be intercepted, corrupted, lost, destroyed, 
arrive late or incomplete, or contain viruses.  The sender therefore 
does not accept liability for any errors or omissions in the contents 
of this message which arise as a result of e-mail transmission.  If 
verification is required please request a hard-copy version.  This 
message is provided for informational purposes and should not be 
construed as a solicitation or offer to buy or sell any securities or 
related financial instruments.

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

View raw message