Take a look at ServletActionRedirectResult, something like this might do it:

   @Inject
   public void setActionMapper(ActionMapper mapper) {
       this.actionMapper = mapper;
   }

to inject the action mapper. I've coined the phrase 'magic injector' to describe this. Then

String uri = actionMapper.getUriFromActionMapping(new ActionMapping(actionName, namespace, method, null))

to get the URI, then

String url = UrlHelper.buildParametersString(requestParameters, uri, "&");

to build the actual url string. That's the gist of it, you should be able to getting something up and running from this.
Tom


Eric Rank wrote:
Thanks Bob,

I wouldn't be too afraid of doing something like that, but I need the URL for a different Action, named in the mapping -- that is, I don't need the URL for the Action that's executing.

Eric Rank


On Jan 30, 2007, at 6:07 PM, bob wrote:


This is surely not the best way . . . but you can implement one of the Aware interfaces that gives you a reference to the ServletRequest and get the URL info from that, from there I assume you could probably build the action specific url. But I'm also sure there must be access to the struts mappings so maybe someone can tell you how to get that.






 --- On Tue 01/30, Eric Rank < [EMAIL PROTECTED] > wrote:
From: Eric Rank [mailto: [EMAIL PROTECTED]
To: user@struts.apache.org
Date: Tue, 30 Jan 2007 16:56:21 -0700
Subject: [s2] Finding a URL of an Action within execute()

Hi List,I'm attempting to construct a URL within an action's execute code. The URL will be sent out in an email, serving as a link for a user to click on. It'd be great if I could do this by finding the URL of an Action using the Action name, which I have defined in the struts.xml file.Is it possible? What's the best way to do it?Thanks,Eric Rank---------------------------------------------------------------------To unsubscribe, e-mail: [EMAIL PROTECTED] additional commands, e-mail: [EMAIL PROTECTED]

_______________________________________________
Join Excite! - http://www.excite.com
The most personalized portal on the Web!



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to