Solved

How to remove .action extension from url in Struts2?

Posted on 2008-10-02
5
1,459 Views
Last Modified: 2013-11-24
I would like to remove action extension so I could use "/login" instead of "/login.action". I tried to use:

struts.action.extension=action,,

but this doesn't work.
0
Comment
Question by:majkic
  • 2
5 Comments
 
LVL 14

Accepted Solution

by:
boonleng earned 500 total points
ID: 22631444
You can use URLRewriteFilter http://raibledesigns.com/rd/entry/extensionless_urls_in_java_web to produce extensionless URL.

If you are using Struts 2.0, you can add SmartURLs plugin http://cwiki.apache.org/S2PLUGINS/smarturls-plugin.html to remove the URL extension. Currently SmartURLs does not work for Struts 2.1.
0
 
LVL 1

Author Comment

by:majkic
ID: 22631591
Actually I'm using Struts 2.1.2, so second solution doesn't work for me. Considering the first one, I'm not quite sure what I need to do to rewrite url. I'm using Spring framework and this probably helps, but I don't see how to setup filter mentioned in this article.
0
 
LVL 14

Expert Comment

by:boonleng
ID: 22684153
It doesnt matter whether using Spring or not, it's a servlet filter.
http://urlrewritefilter.googlecode.com/svn/trunk/src/doc/manual/3.1/index.html
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Impossible to extract MSI from new JAVA releases 2 48
factorial example 4 34
servlet example issue 6 30
How to convert String matching to regex in java 4 19
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now