You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "OFlaherty, Colm" <Co...@kbcam.com> on 2004/02/18 18:50:40 UTC

How to look up a global forward to get its "path" attribute

I have the following entry in my struts-config.xml file: 

<global-forwards>
	<forward name="login" path="/public_login.do"/>
	...
</global-forwards>



In a Tag Library, I have a String "login", and I want to get the string "/public_login.do" (ie, I want to look up the global forward to see the path it refers to).

What is the best way to do this??  

Thanks..


**********************************************************************
This message is sent in confidence for the addressee
only.  The contents are not allowed to be disclosed to
anyone other than the addressee.  Unauthorised 
recipients must preserve this confidentiality and should 
please advise the sender immediately of any error in
transmission.
**********************************************************************


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


Re: How to look up a global forward to get its "path" attribute

Posted by Geeta Ramani <ge...@cmpco.com>.
I know the following works if you have access to a mapping object (as within perform/execute):
mapping.findForward("login").getPath();

So maybe you can simply create a new instance of an actionMapping and so forth..?

Regards,
Geeta

"OFlaherty, Colm" wrote:

> I have the following entry in my struts-config.xml file:
>
> <global-forwards>
>         <forward name="login" path="/public_login.do"/>
>         ...
> </global-forwards>
>
> In a Tag Library, I have a String "login", and I want to get the string "/public_login.do" (ie, I want to look up the global forward to see the path it refers to).
>
> What is the best way to do this??
>
> Thanks..
>
> **********************************************************************
> This message is sent in confidence for the addressee
> only.  The contents are not allowed to be disclosed to
> anyone other than the addressee.  Unauthorised
> recipients must preserve this confidentiality and should
> please advise the sender immediately of any error in
> transmission.
> **********************************************************************
>
> ---------------------------------------------------------------------
> 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 look up a global forward to get its "path" attribute

Posted by Hubert Rabago <ja...@yahoo.com>.
Haven't tried this yet myself, but maybe you can:

    ModuleConfig moduleConfig = RequestUtils.getModuleConfig(pageContext);
    ForwardConfig forward = moduleConfig.findForwardConfig("login");
    String path = forward.getPath();

RequestUtils has been refactored in the nightly build/Struts 1.2 so you might
need to adjust your getModuleConfig() call if you're using a post-1.1
version.

 - Hubert

--- "OFlaherty, Colm" <Co...@kbcam.com> wrote:
> I have the following entry in my struts-config.xml file: 
> 
> <global-forwards>
> 	<forward name="login" path="/public_login.do"/>
> 	...
> </global-forwards>
> 
> 
> 
> In a Tag Library, I have a String "login", and I want to get the string
> "/public_login.do" (ie, I want to look up the global forward to see the
> path it refers to).
> 
> What is the best way to do this??  
> 
> Thanks..
> 
> 
> **********************************************************************
> This message is sent in confidence for the addressee
> only.  The contents are not allowed to be disclosed to
> anyone other than the addressee.  Unauthorised 
> recipients must preserve this confidentiality and should 
> please advise the sender immediately of any error in
> transmission.
> **********************************************************************
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
Yahoo! Mail SpamGuard - Read only the mail you want.
http://antispam.yahoo.com/tools

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