Struts2 Change Action Suffix

 

In this example, we will see how to change or remove the action suffix extension in Struts2.

 

1. Project structure

Struts2 Change Action Suffix

 

2. struts.xml

To change the action suffix extension, we use Struts constant struts.action.extension like bellow :

 

If we want to remove action extension, we just set the empty value :

 

3. JSP page

File : index.jsp

 

4. Test It

Using the extension “.do” : http://localhost:8080/Struts2ChangeActionSuffix/Hello/index.do

Struts2 Change Action Suffix 1

 

Removing the action extension : http://localhost:8080/Struts2ChangeActionSuffix/Hello/index

Struts2 Change Action Suffix 2

 

Download source code