struts2——struts.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"https://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<!-- 定义一个常量 -->
<!--<constant name="struts.devMode" value="true" />-->
<package name="front" extends="struts-default" namespace="/front">
<action name="index">
<result>/Namespace.jsp</result>
</action>
</package>
<package name="main" extends="struts-default" namespace="/main">
<action name="index" class="Test">
<result name="main">/Namespace.jsp</result>
</action>
</package>
</struts> www.2cto.com
<span style="font-family:Arial;BACKGROUND-COLOR: #ffffff">解释说明:package相当于java包的作用,struts.xml中可以存在多个不同名的package,</span>
[html]
<span style="font-family:Arial;BACKGROUND-COLOR: #ffffff">extends相当于java中的继承,这里继承的是系统自带的struts-default.xml文件,</span>
[html]
<span style="font-family:Arial;BACKGROUND-COLOR: #ffffff">namespace是访问路径,例如<a href="https://127.0.0.1:8080/">https://127.0.0.1:8080/</a>项目名称/main/,</span>
[html]
<span style="font-family:Arial;BACKGROUND-COLOR: #ffffff">action 对应就是具体访问的Action类别名,class后面跟的就是具体action类,</span>
[html]
<span style="font-family:Arial;BACKGROUND-COLOR: #ffffff">result 是具体Action类返回的String值,默认是success(实际上是execute方法返回的值)</span>
[html]
<span style="font-family:Arial;BACKGROUND-COLOR: #ffffff"></span>