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>
<!-- 编写常量, 大概的意思就是覆盖其他的配置 -->
<constant name="struts.action.extension" value="do,,"></constant>

<package name="default" namespace="/" extends="struts-default">

<!-- 只要编写了一个action类,就需要在这里配置 -->

<!-- 下面的意思是:

hello:请求地址,就是jsp跳转页面写的:hello.action
class:访问hello跳转执行的类,类的名称和请求跳转的页面没必要一定相同。
method:属性的方法去执行 

如果没有设置的method的话,那么就执行名字是execute的方法,这个是默认值。
然后的话,class也是有默认值的,不过一般都不用
-->
<action name="hello" class="com.itheima.action.HelloAction" method="sayHello">
<!-- 配置跳转的页面 
执行方法return的是什么字符串,这个name属性就写什么字符串,
-->
<result name="ok" type="">/demo1/suc.jsp</result>
</action>
</package>
<!-- 引入其他的配置文件,但是用到的概率不到,了解一下就ok -->
<include file="com/iteima/user/struts_user.xml"></include>
</struts>
原文地址:https://www.cnblogs.com/tidhy/p/6706973.html