Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0

...

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
xmlxml
titleExample struts.xml
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>

...