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

| By Webner

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

<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>


With above changes, we can now call admin action as below :

One comment

  1. 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 *