Solved

How to remove .action extension from url in Struts2?

Posted on 2008-10-02
5
1,469 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
[X]
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
  • 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

Business Impact of IT Communications

What are the business impacts of how well businesses communicate during an IT incident? Targeting, speed, and transparency all matter. Find out more in this infographic.

Question has a verified solution.

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

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
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:
Suggested Courses

738 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