wood burning stoves 2.0*
The moose likes Struts and the fly likes URL rewrite Struts2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "URL rewrite Struts2" Watch "URL rewrite Struts2" New topic
Author

URL rewrite Struts2

Yiorgos Panayiotakis
Greenhorn

Joined: Jul 17, 2009
Posts: 14
How can I rewrite the URL produced by Struts2, so that I can remove .action extension from url.
For example consider the URL below:

I would like to be converted to

I tried struts.action.extension="/" or "" but that does not seem to work.
Also tried to use URLRewriteFilter but also without any success. Has anybody
faced this problem before ? And can anyone point me to a solution for this
problem?

Thanks.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

It does work; Struts 2.1 ships allowing extension-less actions by default.

You might have to be more specific, since this functionality exists out-of-the-box.
Yiorgos Panayiotakis
Greenhorn

Joined: Jul 17, 2009
Posts: 14
Yes I'm aware of that, but I use struts2 (2.0.14) (which as far as I know lacks of that functionality) and I
hesitate to upgrade to struts2.1, cause of the problems luring in such a transition.

So to be more specific, my question is how can I achieve extension-less actions in struts2.0.x?

Thanks.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

You might have to give more config info--people did this in S2.0 with no major issues; maybe providing more will help.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: URL rewrite Struts2
 
Similar Threads
Struts2
How to handle java.lang.NullPointerException in Struts2?..
Struts2: No configuration found for the specified action
struts2 package tag namespace
struts2 CreateQurey