Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Note that you can specify <allowed-methods> even without strict-method-invocation. This restricts access only for the specific actions that have <allowed-methods>.

Code Block
xml
xml
titleExample struts.xml

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
	"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
	"http://struts.apache.org/dtds/struts-2.3.dtd">
<struts>

  <constant name="struts.enable.DynamicMethodInvocation" value="true"/>

  <package name="default" extends="struts-default" strict-method-invocation="true">

	<action name="index" class="org.apache.struts2.examples.actions.Index">
		<result name="success" type="redirectAction">hello</result>
	</action>

	<action name="hello" class="org.apache.struts2.examples.actions.HelloAction">
		<result name="success">/WEB-INF/content/hello.jsp</result>
		<result name="redisplay" type="redirectAction">hello</result>
		<allowed-methods>add</allowed-methods>
	</action>

  </package>
</struts>
Warning

Strict DMI doesn't work with the Convention Plugin yet!

ActionSupport Default

If the class attribute in an action mapping is left blank, the com.opensymphony.xwork2.ActionSupport class is used as a default.

...