File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes How to hide action Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to hide action "extension" in URL? (Struts2)" Watch "How to hide action "extension" in URL? (Struts2)" New topic

How to hide action "extension" in URL? (Struts2)

Leonardo Carreira
Ranch Hand

Joined: Apr 07, 2009
Posts: 489

Hi Friends...

i have a question..
iam using Struts2..
how to hide action "extension" in URL?..
ussually i go to URL by write down :

what i have to do to access URL by only write down :

its like this website..

is it any configuration in our struts.xml?..

Thanks before...

Sorry, perhaps my english language isn't too good.. Prepare for SCJP 6, Please God help me.. ☼
References : [Java.Boot] [JavaChamp] [JavaPrepare]
Nishan Patel
Ranch Hand

Joined: Sep 07, 2008
Posts: 689


I think if you put one line code at your struts.xml

<constant name="struts.action.extension" value="" /> then you can get your solution.

If you get your solution at least let me know by punting one comment.

Thanks, Nishan Patel
SCJP 1.5, SCWCD 1.5, OCPJWSD Java Developer,My Blog
David Newton

Joined: Sep 29, 2008
Posts: 12617

S2.1 ships with the extension set to "action," so it's enabled by default. The REST plugin also uss extension-less mappings by default.
Leonardo Carreira
Ranch Hand

Joined: Apr 07, 2009
Posts: 489


iam so sorry for my late post reply..

okay.. its run well.. but its happen all of configuration in my application has to changed..

yeah maybe i will use it in next application..

I agree. Here's the link:
subject: How to hide action "extension" in URL? (Struts2)
It's not a secret anymore!