Solved

How to remove .action extension from url in Struts2?

Posted on 2008-10-02
5
1,454 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
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…

758 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

21 Experts available now in Live!

Get 1:1 Help Now