You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Antony Paul <an...@hotmail.com> on 2003/12/09 15:37:11 UTC

How to set action path from Action.

Hi,
    After user login based on the dept of user user has to forwarded to
pages in different directories. How to do it ?. There are 5 departments.
This directory and page to be used in other parts to identify the home page
and directory of user so at other times user can be redirected. Putting a
ForwardAction in struts-config.xml which accepts and checks a single
parameter(Home) is possible ? Or set the path of a global forward at
runtime. I am new to Struts. Other options are
1. Write another action class which takes this parameter and based on the
user dept got from session invoke corresponding ForwardAction. This action
is reached through a global forward.
2. Use modules. I dont know what is it. Is it possible to have same named
ForwardAction in different modules ?.

rgds
Antony Paul.

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: How to set action path from Action.

Posted by Antony Paul <an...@hotmail.com>.
Thanks for reply.
Ok I got what I need. I will do this. In struts-config.xml I will put 5
ForwardActions like this
<action path="/Sales_Home" forward="/sales/index.jsp"/>
<action path="/HR_Home" forward="/hr/index.jsp"/>
etc.
At login time a parameter wil be put in the session 'home' with a value of
each users home which is the path attribute of action element defined
earlier. In every JSP the link is provided like this.
<html:link action="<%=session.getAttribute("home").toString()%>">Log
out</html:link>
This will work in JSP's. But how to invoke this action from another action
class. I have to construct a new ActionForward like this.
return new ActionForward("/home.do");

Also how to invoke global forward from action class.

rgds
Antony Paul

----- Original Message -----
From: "Ted Husted" <hu...@apache.org>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Tuesday, December 09, 2003 9:31 PM
Subject: Re: How to set action path from Action.


> The different entry points should each be represented by their own
> ActionForwards. The Action class decides to forward the user to
> "science" or "biology". The ActionForward supplies the page and directory.
>
> Generally, it is helpful to think of the ActionForwards as boxes on a
> flowchart. The Action class encapsulates the logic that decides it is
> time to forward to this box or that box. The directory and pages are
> implmentation details. The focal point is the *logical* names of the
> ActionForward, not the paths they encapsulate.
>
> HTH, Ted.
>
> Antony Paul wrote:
> > Hi,
> >     After user login based on the dept of user user has to forwarded to
> > pages in different directories. How to do it ?. There are 5 departments.
> > This directory and page to be used in other parts to identify the home
page
> > and directory of user so at other times user can be redirected. Putting
a
> > ForwardAction in struts-config.xml which accepts and checks a single
> > parameter(Home) is possible ? Or set the path of a global forward at
> > runtime. I am new to Struts. Other options are
> > 1. Write another action class which takes this parameter and based on
the
> > user dept got from session invoke corresponding ForwardAction. This
action
> > is reached through a global forward.
> > 2. Use modules. I dont know what is it. Is it possible to have same
named
> > ForwardAction in different modules ?.
> >
> > rgds
> > Antony Paul.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: struts-user-help@jakarta.apache.org
> >
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: How to set action path from Action.

Posted by Ted Husted <hu...@apache.org>.
The different entry points should each be represented by their own 
ActionForwards. The Action class decides to forward the user to 
"science" or "biology". The ActionForward supplies the page and directory.

Generally, it is helpful to think of the ActionForwards as boxes on a 
flowchart. The Action class encapsulates the logic that decides it is 
time to forward to this box or that box. The directory and pages are 
implmentation details. The focal point is the *logical* names of the 
ActionForward, not the paths they encapsulate.

HTH, Ted.

Antony Paul wrote:
> Hi,
>     After user login based on the dept of user user has to forwarded to
> pages in different directories. How to do it ?. There are 5 departments.
> This directory and page to be used in other parts to identify the home page
> and directory of user so at other times user can be redirected. Putting a
> ForwardAction in struts-config.xml which accepts and checks a single
> parameter(Home) is possible ? Or set the path of a global forward at
> runtime. I am new to Struts. Other options are
> 1. Write another action class which takes this parameter and based on the
> user dept got from session invoke corresponding ForwardAction. This action
> is reached through a global forward.
> 2. Use modules. I dont know what is it. Is it possible to have same named
> ForwardAction in different modules ?.
> 
> rgds
> Antony Paul.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: How to set action path from Action.

Posted by Ashish Kulkarni <ku...@yahoo.com>.
Hi
have you tried using DispatchAction, may be it can
help you, i use to forward action to different jsp
depending on what button on clicked by the user.

Ashish
--- Antony Paul <an...@hotmail.com> wrote:
> Hi,
>     After user login based on the dept of user user
> has to forwarded to
> pages in different directories. How to do it ?.
> There are 5 departments.
> This directory and page to be used in other parts to
> identify the home page
> and directory of user so at other times user can be
> redirected. Putting a
> ForwardAction in struts-config.xml which accepts and
> checks a single
> parameter(Home) is possible ? Or set the path of a
> global forward at
> runtime. I am new to Struts. Other options are
> 1. Write another action class which takes this
> parameter and based on the
> user dept got from session invoke corresponding
> ForwardAction. This action
> is reached through a global forward.
> 2. Use modules. I dont know what is it. Is it
> possible to have same named
> ForwardAction in different modules ?.
> 
> rgds
> Antony Paul.
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
> 


=====
A$HI$H

__________________________________
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org