Meaningless Drivel is fun!*
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
Author

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?..
example..
ussually i go to URL by write down :
http://localhost:8080/MyApplication/Category/new.action
http://localhost:8080/MyApplication/Category/edit.action?id=1

what i have to do to access URL by only write down :
http://localhost:8080/MyApplication/Category/new
http://localhost:8080/MyApplication/Category/edit?id=1

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: 684

hi,

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
Author
Rancher

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

Hi..

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..

Thank's
 
Consider Paul's rocket mass heater.
 
subject: How to hide action "extension" in URL? (Struts2)
 
Similar Threads
How to handle java.lang.NullPointerException in Struts2?..
linking struts2 action to pre-existing pure Java servlet
struts2 path problem
How to hide .jsp extension?
URL rewrite Struts2