Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

How to remove .action extension from url in Struts2?

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
java jdbc batch example 8 41
ejb example issues 3 26
Facing this issue for maven proxy setting 2 20
What's wrong with this code? 4 26
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 will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
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…

861 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