You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Kiet Nguyen <KN...@coolcast.com> on 2001/06/15 14:41:22 UTC

preprocess suggestion on struts change

I think action classes should allow a method(preloadPerform) definition.
This method would be called prior to the form being load.  This way we can
initialize form values and do pre-process stuff.  Currently I have a link to
"doSomething.do" which execute a corresponding DoSomethingAction class; the
action will then redirect to actual page.  I populate the form and do some
business processing in the doSomethingAction class.  Is this how it is
intended to work.

kiet

Re: preprocess suggestion on struts change

Posted by Martin Cooper <ma...@tumbleweed.com>.
The Action.perform() method is where you should be setting up the beans your
JSP will use. That seems to be what you are doing (although typically you
will forward, rather than redirect, to the JSP page).

What is it that you're looking for in a pre-process method? Do you mean
something that is called before the action (in which case Oleg's reply
describes a solution), or something that is called after the perform()
method but before the JSP execution?

--
Martin Cooper


----- Original Message -----
From: "Kiet Nguyen" <KN...@coolcast.com>
To: "Struts-User (E-mail)" <st...@jakarta.apache.org>
Sent: Friday, June 15, 2001 5:41 AM
Subject: preprocess suggestion on struts change


> I think action classes should allow a method(preloadPerform) definition.
> This method would be called prior to the form being load.  This way we can
> initialize form values and do pre-process stuff.  Currently I have a link
to
> "doSomething.do" which execute a corresponding DoSomethingAction class;
the
> action will then redirect to actual page.  I populate the form and do some
> business processing in the doSomethingAction class.  Is this how it is
> intended to work.
>
> kiet



Re: preprocess suggestion on struts change

Posted by Oleg V Alexeev <go...@penza.net>.
Hello Kiet,

Friday, June 15, 2001, 4:41:22 PM, you wrote:

KN> I think action classes should allow a method(preloadPerform) definition.
KN> This method would be called prior to the form being load.  This way we can
KN> initialize form values and do pre-process stuff.  Currently I have a link to
KN> "doSomething.do" which execute a corresponding DoSomethingAction class; the
KN> action will then redirect to actual page.  I populate the form and do some
KN> business processing in the doSomethingAction class.  Is this how it is
KN> intended to work.

KN> kiet

There is already such method in ActionServlet -
 processPreprocess

It is called before ActionForm creation and filling. In ActionServlet
it is empty - you can override it without any problems.

-- 
Best regards,
 Oleg                            mailto:gonza@penza.net