Hi Adam,

On Mon, Apr 21, 2008 at 6:02 PM, Adam Hardy
<[EMAIL PROTECTED]> wrote:
> Just had a long search through the struts source and can't see how this is
> done.
>
>  I want to obtain the ActionMapper so that I can get the URL for an action,
> in the same way that the Form taglib does it:
>
>
>  ActionMapping mapping = new ActionMapping(action, namespace, actionMethod,
> parameters);
>  String result =
> UrlHelper.buildUrl(actionMapper.getUriFromActionMapping(mapping), request,
> response, null);
>
>  It seems to be injected into the Form taglib, but I can't see how or where.

Check out the setter...

    protected ActionMapper actionMapper;

<snip ... />

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

So if you want your own "Component" to be injected with the
ActionMapper, annotate it to the setter. Your tag which creates the
component bean has to extend the ComponentTagSupport class, or you can
see how it's done in ComponentTagSupport.doStartTag().

Cheers,
-Ralf

>
>  Where can I call it from, or is there another way to get the URL for any
> mapping?
>
>
>  Thanks
>  Adam
>
>  ---------------------------------------------------------------------
>  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