struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Howard Miller">
Subject Re: How to add a pre-action
Date Sun, 20 Oct 2002 15:56:11 GMT
I think I'm seriously missing the point here! I have looked at the example application 
in some detail and it appears to add a parameter (eg, ?action=new) to tell the action 
for a form to perform an initialising action. I don't see it using a "pre-" action.

I am incredibly stuck with the concept of how to code an action that is not 
encumbered with *special* parameters to pre-load the bean data. My particular 
problem is that I have pages where the previous page cannot be predicted, so the jsp 
must have a means of loading its own data.

I would really appreciated some pointers as to how to set this up. *** I particularly 
don't understand how to get the action to call the following JSP *** (ie, I would really 
appreciate some specific - example - help on this!! ). At least every method I have 
tried doesn't work.

I do understand how to actually create a bean manually and put in in the scope. I 
don't understand how to set up a generic preload action for a given JSP/ActionForm, 
and what the config should look like.

Again, any help much appreciated.


On 20 Oct 2002 at 8:43, David M. Karr wrote:

> >>>>> "Howard" == Howard Miller <> writes:
>     Howard> Hi,
>     Howard> Can somebody kindly help me with the following...
>     Howard> I want to add a path and an Action class. The action class will then preload
data into 
>     Howard> a bean and then forward (do I mean forward) to the jsp that displays the
bean. That's 
>     Howard> it. I want this action to be in *addition* to the *normal* jsp/formbean/action
>     Howard> I can't see how to do it.... in particular
>     Howard> 1. I don't think I fully understand how/why an action is associated with
a bean in 
>     Howard> struts-config. What does the action servlet do with this information.
>     Howard> 2. How do I properly forward from an action to a jsp with the bean information
>     Howard> It seems to be very similar to an action returning its "input form" to
display errors, but 
>     Howard> doing this doesn't work.  Whatever I do I seem to get a blank page.
> In fact, the best practice is to always preface a page with an action.  You end
> up with actions that prepare information for a page, and actions which process
> information for a page.  The actions which process the page information will
> always have had the form bean created before you get to the action.  However,
> the actions which prepare the page information may have to manually create the
> form bean and put it into the appropriate scope.
> Note that the welcome page for an application would normally be something like
> "index.jsp", which does nothing but forward to an action to start the
> application.  You can't preface the welcome page with an action, but you can
> make it do nothing but go to an action to prepare the real first page.
> Look at the source code for the "example" application for some examples of
> using the form bean.  The user guide also talks about the control flow with
> respect to form beans.
> -- 
> ===================================================================
> David M. Karr          ; Java/J2EE/XML/Unix/C++
> --
> To unsubscribe, e-mail:   <>
> For additional commands, e-mail: <>

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

View raw message