javaEE Struts2, 默认配置, Action配置的默认值

src/struts.xml(Struts2的核心配置文件):

<?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>
		<package name="default" namespace="/default" extends="struts-default" >
		
			<!-- 找不到包下的action,会使用IndexAction作为默认action处理请求; 在action配置之前进行配置 -->
			<default-action-ref name="IndexAction"></default-action-ref>
			
			<!-- 默认配置,默认值 -->
			<!-- method属性:execute 默认执行execute方法 -->
			<!-- result的name属性:success  默认返回"success" -->
			<!-- result的type属性:dispatcher 转发  -->
			<!-- class属性:com.opensymphony.xwork2.ActionSupport -->
			<action name="DemoAction" >
				<result  >/hello.jsp</result>
			</action>
			
		</package>
</struts>

猜你喜欢

转载自blog.csdn.net/houyanhua1/article/details/81117980