----- Original Message ----- 
From: "Robert Taylor" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Thursday, September 18, 2003 2:02 PM
Subject: RE: [repost] Special view information -> ActionForm or request?


> Sorry for jumping in, but I've been lurking on this thread
> and I use this pattern quite frequently.
>
> SetupAction ===> page ===> ProcessAction ===> page
>
> I have a dynamic form defined in my struts config file and
> mapped to both SetupAction and ProcessAction. I don't have
> to manually create the form because Struts does this for me.
> Its actually very simple:
>
> In SetupAction:
>
> ActionForward forward = mapping.findForward("success");
> DynaBean input = (DynaBean)form;
> // populate input
> return forward
>
> Upon validation failure, my ProcessAction input attribute is set to the
> action mapping for SetupAction. I can see how this could be seen as a bit
> of a hack, but its just using the existing framework to meet my
> requirements.

I don't understand this approach.  If you need special info in the view you
first call a SetupAction and then have that action forward to a
ProcessAction?  I thought this wouldn't work because the form bean is
recreated with each pass through the ActionServlet.  Maybe it does work if
the form bean is in session scope?  Also, this sounds like action chaining
to me, which is not considered a Struts best practice.

> If the data to display is static I just place it in ServletContext
> when the application starts up and there is no need to necessarily have
> a SetupAction.

I think this is a standard approach and that it is considered a Struts best
practice.

> Upon validation, you can simply forward directly to the input page.
>
>
> How is that clumsy? Am I missing something?
>
> robert


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to