You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jq Jr <4f...@gmail.com> on 2008/10/01 15:23:07 UTC

removing the extension in url in struts 2

Hi All,

Can anyone tell me how to remove the extension of url in struts 2 ?

Like
/login instead of 
/login.action
-- 
View this message in context: http://www.nabble.com/removing-the-extension-in-url-in-struts-2-tp19760365p19760365.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: removing the extension in url in struts 2

Posted by RajeshSR <ra...@ust-global.com>.
set the constant in ur struts.xml file

    <constant name="struts.action.extension" value=""/>


removing the extension in url in struts 2

Jq Jr wrote:
> 
> Hi All,
> 
> Can anyone tell me how to remove the extension of url in struts 2 ?
> 
> Like
> /login instead of 
> /login.action
> 

-- 
View this message in context: http://www.nabble.com/removing-the-extension-in-url-in-struts-2-tp19760365p20974077.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: removing the extension in url in struts 2

Posted by Alex Coles <al...@gmail.com>.
On Fri, Oct 3, 2008 at 6:31 PM, Owen Berry <ow...@gmail.com> wrote:
>
> Here's a small sample out of my struts.xml file; let me know if you
> need a little more.
>
>  <package namespace="/" name="home" extends="tiles-default">
>    <action name="">
>      <result type="tiles">home</result>
>    </action>
>    <action name="home">
>      <result type="tiles">home</result>
>    </action>
>  </package>
>
> I can access the above with any of the following URLs:
>
>  /
>  /home
>  /home.action
>  /.action   (yip!)
>
> If I access it with a .action extension, then all links in my
> application get the extension appended. Maybe that's a clue for you -
> maybe the first page you hit (through a redirect or something) has an
> extension, and therefore all links get extensions automatically.
>
> My struts.properties file doesn't have anything relevant in it - I'm
> using the default value for struts.action.extension, which I mentioned
> in my previous email.
>
> Hope that helps.
>
> Owen
>
> On Fri, Oct 3, 2008 at 6:48 AM, Jq Jr <4f...@gmail.com> wrote:
> >
> >  Hi,
> > Thanks for the reply friends.
> >
> > Owen which version of struts are you using?
> > And can you post your struts.xml and struts.properties files.
> > Actually I am not using the struts.properties instead I am putting those
> > values in <constants ...> tag.
> > Is it required to have struts.properties to remove the extension?
> >
> >
> > Thanks
> >
> >
> > Jq Jr wrote:
> >>
> >> Hi All,
> >>
> >> Can anyone tell me how to remove the extension of url in struts 2 ?
> >>
> >> Like
> >> /login instead of
> >> /login.action
> >>

I don't know if the following blog article is any use to you?
http://raibledesigns.com/rd/entry/extensionless_urls_in_java_web

I've been using UrlRewriteFilter to handle a lot  of situations where
the framework can't do the style of "clean" URLs that I would like.

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


Re: removing the extension in url in struts 2

Posted by Owen Berry <ow...@gmail.com>.
Here's a small sample out of my struts.xml file; let me know if you
need a little more.

  <package namespace="/" name="home" extends="tiles-default">
    <action name="">
      <result type="tiles">home</result>
    </action>
    <action name="home">
      <result type="tiles">home</result>
    </action>
  </package>

I can access the above with any of the following URLs:

  /
  /home
  /home.action
  /.action   (yip!)

If I access it with a .action extension, then all links in my
application get the extension appended. Maybe that's a clue for you -
maybe the first page you hit (through a redirect or something) has an
extension, and therefore all links get extensions automatically.

My struts.properties file doesn't have anything relevant in it - I'm
using the default value for struts.action.extension, which I mentioned
in my previous email.

Hope that helps.

Owen

On Fri, Oct 3, 2008 at 6:48 AM, Jq Jr <4f...@gmail.com> wrote:
>
>  Hi,
> Thanks for the reply friends.
>
> Owen which version of struts are you using?
> And can you post your struts.xml and struts.properties files.
> Actually I am not using the struts.properties instead I am putting those
> values in <constants ...> tag.
> Is it required to have struts.properties to remove the extension?
>
>
> Thanks
>
>
> Jq Jr wrote:
>>
>> Hi All,
>>
>> Can anyone tell me how to remove the extension of url in struts 2 ?
>>
>> Like
>> /login instead of
>> /login.action
>>
>
> --
> View this message in context: http://www.nabble.com/removing-the-extension-in-url-in-struts-2-tp19760365p19795497.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> 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


Re: removing the extension in url in struts 2

Posted by Jq Jr <4f...@gmail.com>.
 Hi,
Thanks for the reply friends.

Owen which version of struts are you using?
And can you post your struts.xml and struts.properties files.
Actually I am not using the struts.properties instead I am putting those
values in <constants ...> tag.
Is it required to have struts.properties to remove the extension?


Thanks


Jq Jr wrote:
> 
> Hi All,
> 
> Can anyone tell me how to remove the extension of url in struts 2 ?
> 
> Like
> /login instead of 
> /login.action
> 

-- 
View this message in context: http://www.nabble.com/removing-the-extension-in-url-in-struts-2-tp19760365p19795497.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: removing the extension in url in struts 2

Posted by Owen Berry <ow...@gmail.com>.
As far as I can see, the default is:

struts.action.extension=action,,

and with that setting, accessing /login will work. I'm using it that
way without any problems.

On Wed, Oct 1, 2008 at 9:30 AM, duschhaube <du...@gmx.net> wrote:
> Hi,
>
> the extension can be configured in the struts.properties
> struts.action.extension=action
>
> but i dont knoe if you can leave it empty.
>
> maybe you should consider to you the rest-plugin.
>
>
>
> Jq Jr schrieb:
>>
>> Hi All,
>>
>> Can anyone tell me how to remove the extension of url in struts 2 ?
>>
>> Like
>> /login instead of /login.action
>
>
> ---------------------------------------------------------------------
> 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


Re: removing the extension in url in struts 2

Posted by duschhaube <du...@gmx.net>.
Hi,

the extension can be configured in the struts.properties
struts.action.extension=action

but i dont knoe if you can leave it empty.

maybe you should consider to you the rest-plugin.



Jq Jr schrieb:
> Hi All,
> 
> Can anyone tell me how to remove the extension of url in struts 2 ?
> 
> Like
> /login instead of 
> /login.action


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