一、配置文件
strtus.xml
1 <?xml version="1.0" encoding="UTF-8" ?> 2 <!DOCTYPE struts PUBLIC 3 "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN" 4 "http://struts.apache.org/dtds/struts-2.3.dtd"> 5 6 <struts> 7 <!-- 启用开发者模式,当修改struts配置文件时不用重启服务器 --> 8 <constant name="struts.devMode" value="true" /> 9 <!-- 10 include的意思 是: 11 引用default.xml 12 --> 13 <include file="default.xml"></include> 14 15 </struts>
default.xml
1 <?xml version="1.0" encoding="UTF-8" ?> 2 <!DOCTYPE struts PUBLIC 3 "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN" 4 "http://struts.apache.org/dtds/struts-2.3.dtd"> 5 6 <struts> 7 <package name="default" namespace="/" extends="struts-default"> 8 <!-- 指定默认的Action 9 如:localhost:8080/Struts2_InclueAndDefaultAction/abfdsfsfsdfs 10 当访问的Action不存在时会访问默认的Action 11 --> 12 <default-action-ref name="default"></default-action-ref> 13 <action name="default" > 14 <result>/default.jsp</result> 15 </action> 16 </package> 17 18 </struts>
初识Struts2_include和default-action-ref,布布扣,bubuko.com
初识Struts2_include和default-action-ref
原文:http://www.cnblogs.com/suemailit/p/3670408.html