You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Amit Rana <am...@gmail.com> on 2007/11/15 09:32:38 UTC

action and method separator using something other than action!method

Hi,

 I have a url for login
<s:url id="loginurlid" namespace="/" action="login" method="input"></s:url>

 This generates a url like http://localhost:8080/myapp/login!input.action

 Is there a way to tell s:url to use _ or / as separator and not !

Thanks,
Amit.

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


Re: [struts] action and method separator using something other than action!method

Posted by Dale Newfield <Da...@Newfield.org>.
> Amit Rana wrote:
>>  I have a url for login
>> <s:url id="loginurlid" namespace="/" action="login" 
>> method="input"></s:url>
>>
>>  This generates a url like http://localhost:8080/myapp/login!input.action
>>
>>  Is there a way to tell s:url to use _ or / as separator and not !

In struts.xml you can define any name you want for your action, which is 
really just an alias for an action class/method combination:

<action name="loginBecauseISaidSo" class="loginAction" method="input">

then the url can be generted by
<s:url id="loginurlid" namespace="" action="loginBecauseISaidSo"/>
with the resulting url (relative to your app) of /loginBecauseISaidSo.action

Basically, if you're specifying the method in s:url, then in my opinion 
you're missing an action mapping in struts.xml.

-Dale

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


Re: action and method separator using something other than action!method

Posted by Omkar patil <os...@gmail.com>.
Amit,

I am not sure if there is any easy way to achieve this. Is there any 
specific reason you would like achieve this? One way could be provide 
your own action mapper class by extending DefaultActionMapper and 
overriding getUriFromActionMapping method to provide your own separator.

-Omkar

Amit Rana wrote:
> Hi,
>
>  I have a url for login
> <s:url id="loginurlid" namespace="/" action="login" method="input"></s:url>
>
>  This generates a url like http://localhost:8080/myapp/login!input.action
>
>  Is there a way to tell s:url to use _ or / as separator and not !
>
> Thanks,
> Amit.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>   


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