struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Germuska <>
Subject Re: Eliminate Setup Actions
Date Wed, 09 Mar 2005 04:35:13 GMT
>And I've been silently wishing you'd add it, too. :)
>We've had discussions about this maybe twice before, and another time
>I lit the flame, you responded, but I wasn't able to follow through
>with the discussion.

Well, then, now you've gone and done it, Hubert...  I've just 
committed the basic support for per-forward commands.

I think the next step would be to write a simple command which looks 
something like this:

public class FormPrepCommand implements Command {
private String formName; // property
private String formScope; // property

public boolean execute(Context context) {

   if (this.formName != null) {
     ActionContext actionCtx = (ActionContext) context;
     ActionForm form = lookupForm(formName,formScope, actionCtx);
     prepareForm(actionCtx, form);
     return false;

   protected ActionForm lookupForm(String formName, String formScope, 
ActionContext ctx) {
     // standard behavior for looking up a form and making sure its in 
the right request/session scope
     // classes would rarely override this; maybe it would be private.

   protected abstract void prepareForm(ActionContext ctx, ActionForm form);


Then one could use one or more of these in a per-forward chain of 
renders.  Of course other commands could do non-form oriented setup.

Related to what I just checked in, I still like a model where rather 
than configuring command and catalog on each ForwardConfig, a lookup 
is done based on the "path" value of the ForwardConfig.  No reason 
not to have both, of course, but I just think my style would be to 
have a catalog named "page-prep" and a different command in 
process-view which worked this way.


Joe Germuska       
"Narrow minds are weapons made for mass destruction"  -The Ex

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

View raw message