Java Struts | How to remove the action extension in Struts 2 framework

Author - Neha Mishra
6.03.2017
|
1 Comment
|

In struts.xml file of your web project, replace value for constant named “struts.action.extension” to as shown below :

<struts>
<constant name = "struts.action.extension" value=",">
</constant> <!-- we have set value for this constant to comma that means no extension as suffix like “ admin.action “ is required to call any action, if constant not present add it -->
<constant name = "struts.enable.DynamicMethodInvocation" value="false" />
<constant name = "struts.ui.theme" value="simple" />
<constant name = "struts.custom.i18n.resources" value="ApplicationResources" />

<package name= "default" extends= "struts-default" >
<action name ="admin" class="classpath" method="getDashboard">
<interceptor-ref name="defaultStack" />
<result name ="success"> admin.jsp </ result >
</ action>
</package>

</struts>

With above changes, we can now call admin action as below :
http://localhost:8080/SampleProject/admin

Webner Solutions is a Software Development company focused on developing Insurance Agency Management Systems, Learning Management Systems and Salesforce apps. Contact us at dev@webners.com for your Insurance, eLearning and Salesforce applications.

One response on “Java Struts | How to remove the action extension in Struts 2 framework

  1. priya says:

    Spring provides its own web framework , while at the same time providing integration with a number of popular third party web frameworks. Many thanks for sharing this.

Leave a Reply

Your email address will not be published. Required fields are marked *