You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by peter <p_...@gmx.de> on 2001/07/10 08:50:02 UTC

Action BEFORE a page is constructed?

Action BEFORE a page is constructed?

As far as I understood the working of struts, you inherit the FORM and
the ACTION classes. The forms are constructed BEFORE a page is shown -
if values
are already available, they will be shown. AFTER the page is submitted,
the
ACTION is called with the FORM element filled with the appropriate
values.

But what do I do to make any data available to the next page?

I can do so in the preceeding ACTION. But this means, I have to do so in
all
preceding actions of this page. This would be a copy of code.
So I am simply looking for a way to be called, just BEFORE the page is
created.
The only mehtod I know, is the Construction of the FORM. But there I do
not have any link to the SessionContext which is my main anker element.

If anyone has an idea what I am talking about, please help.

Thanks
Peter

p_spiessbach@gmx.de




Re: Action BEFORE a page is constructed?

Posted by Adam Hardy <ad...@yahoo.com>.
One way to populate a form before it is used (say you
want to load user information for editing) is to
create an action called preloadUserAction.  In the
config file create an action mapping such as 

<action    path="/edituser"
                      
type="actionbeans.PreloadUserAction"
                       name="userForm"
                       scope="session"
                       input="/selfAdmin.jsp">
        <forward   name="success"             
path="/selfAdmin.jsp"/>
    </action>

The userForm is passed into the preload action.  This
populates the form and then forwards onto the page
that will use that form.  The example application uses
the same technique but is a bit more complex because
the action is dual use: see EditSubscriptionAction.

Adam.
--- peter <p_...@gmx.de> wrote:
> Action BEFORE a page is constructed?
> 
> As far as I understood the working of struts, you
> inherit the FORM and
> the ACTION classes. The forms are constructed BEFORE
> a page is shown -
> if values
> are already available, they will be shown. AFTER the
> page is submitted,
> the
> ACTION is called with the FORM element filled with
> the appropriate
> values.
> 
> But what do I do to make any data available to the
> next page?
> 
> I can do so in the preceeding ACTION. But this
> means, I have to do so in
> all
> preceding actions of this page. This would be a copy
> of code.
> So I am simply looking for a way to be called, just
> BEFORE the page is
> created.
> The only mehtod I know, is the Construction of the
> FORM. But there I do
> not have any link to the SessionContext which is my
> main anker element.
> 
> If anyone has an idea what I am talking about,
> please help.
> 
> Thanks
> Peter
> 
> p_spiessbach@gmx.de
> 
> 
> 


__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/