Suppose, Joe, that we have first.jsp and second.jsp, FirstActionForm.java and SecondActionForm.java. We call MyAction.java as the action for <html:form> in first.jsp and want to setup the values in second.jsp via SecondActionForm.java. How would you configure the <action-mapping> for this use case, which I think is the most common use case there is?
<action path="/FirstAction" name="FirstActionForm" type="ProcessFirstActionFormAction">
<set-property key="view.formName" value="SecondActionForm" />
<forward name="success" path="/second.jsp" />
</action>
public class ProcessFirstActionFormAction extends Action {
public ActionForward execute(mapping,form,request,response) {
// perform business logic based on form, instance of FirstActionForm
String viewFormName = mapping.getProperty("view.formName");
ActionForm viewForm = methodWhichLooksUpForm(request, viewFormName);
// set up viewForm, which is expected to be an instance of SecondActionForm.java
}
}
Did I understand your question? This is assuming that you wanted to do everything in an Action, which isn't my preference -- but it's possible.
If I misunderstood, please clarify.
Joe
Jack
On Thu, 17 Mar 2005 15:43:28 -0600, Joe Germuska <[EMAIL PROTECTED]> wrote:At 1:13 PM -0800 3/17/05, Dakota Jack wrote: ><SNIP> >On Thu, 17 Mar 2005 14:55:17 -0600, Joe Germuska <[EMAIL PROTECTED]> wrote: >> At 9:58 AM -0800 3/17/05, Dakota Jack wrote: >> >Cool, I think. Do you mean you can do this with the <action-mapping>? >> > Sorry if this is a really stupid question. I have not looked at the >> >configuration of v1.3. If this is going to be possible, you will have >> >solved half the qusetions on the list. >> >> Yep: >> http://svn.apache.org/viewcvs.cgi?rev=111970&view=rev >> original discussion thread: >> http://thread.gmane.org/gmane.comp.jakarta.struts.devel/23510 >> ................ >> The model I have in mind right now for setting up forms, though, >> doesn't use the action mapping but rather links the form name to the >> ForwardConfig. It seems more natural to me to associate the set up >> with the destination, and it happens once in a while that you have >> more than one action which processes a request which all forward to >> the same response/view. ><SNIP> > >I would like to be able to set multiple forms in the <action-mapping>. > Is there any reason why you won't allow that?
well, no, and I don't see why you can't using this arbitrary property map. I'm not sure what you think the best way for getting form objects from the properties (I think the framework could make it easier than it is now), but I think it should all be possible.
And the description I posted could have any number of FormPrepCommands -- something I have never needed myself but which was pointed out as a need on the list. I had originally envisioned just setting "name" and "scope" on the ForwardConfig itself, but one or more people brought up the use case you suggest, and my thought is that the per-forward chain supports that pretty readily. If you think I've missed something, please let me know.
Joe
-- Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com "Narrow minds are weapons made for mass destruction" -The Ex
-- "You can lead a horse to water but you cannot make it float on its back." ~Dakota Jack~
--
Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com "Narrow minds are weapons made for mass destruction" -The Ex
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]