I suppose storing the information in the session would work. Though, I
imagine this means the state value would be hardcoded into the Java
source. I'm working toward scripting workflows from within the
ActionMappings, and would like to be able to reroute the flow without
changing the Java source.

The insert/update flow is one example. Another would be inserting one
record and stopping, or inserting one record type and then another type
(and another type). Like say, creating a new vendor account, and then a
contact record for the account, and then a new stock item for the
account. With a dynamic action path, you can script something like this
from the ActionMappings alone, without modifying the JSPs or Java
source.

I'm also now thinking that, given a dynamic action path, the best place
to represent it may be the ActionForward after all. This would change
the struts-config in my last post to:

<action ...>
 <forward 
   name="continue"  
   path="/WEB-INF/pages/script/Form.jsp"
   request="true"
  actionPath="/script/Insert"/>
</action>

which supports the idea of having an Action return various logical
forwards, which could map to various forms, and being able to program
where those forms submit back to, all from within the ActionMappings.

Matthias Bauer wrote:
> In the actions DisplayInsertAction or DisplayUpdateAction respectively, I store
> a state value in session scope which is checked in ProcessAction and upon with I
> decide whether to do an update or insert.
> 
> With this pattern I do not really see the necessity to dynamically set the
> action attribute in forms.
> 
> Do I miss something?
> 
> --- Matthias
> 
> Ted Husted wrote:
> 
> > The general idea I'm playing with now is
> >
> > 1) Extend ActionMappings with "request" and "actionPath" properties.
> >
> > 2) Extend ActionServlet to place the ActionMapping in the request
> > context if request=true.
> >
> > 3) Extend html:form to check for ActionMapping.getActionPath() when the
> > path is not specified.
> >
> > So in struts-config you could specify
> >
> > request="true"
> > actionPath="/insertAction"
> > parameter="insert"
> >
> > or
> >
> > request="true"
> > actionPath="/updateAction"
> > parameter="update"
> >
> > and have the appropriate path automagically appear in your html:form.
> > The Action can then call getParameter() to determine whether it's
> > suppose to insert or update the ActionForm data. Viola, no hidden
> > fields!

Reply via email to