这个是web.xml的基本配置
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
这个是Struts2.xml的基本配置
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<constant name="struts.devMode" value="true" />
<!-- 上面是常量的开发模式 -->
<package name="default" namespace="/" extends="struts-default">
<!-- 如果路径都不精确的,找namespace为空的 ,name和namespace最好一样的名字 -->
<action name="hello" class="action.IndexAction" method="check">
<result name="success">/login.jsp</result>
</action>
</package>
<!-- Add packages here -->
</struts>
这个是通配符的基本配置,1,表示第一个星号
<struts>
<constant name="struts.devMode" value="true" />
<!-- 上面是常量的开发模式 -->
<package name="default" namespace="/" extends="struts-default">
<!-- 如果路径都不精确的,找namespace为空的 ,name和namespace最好一样的名字 -->
<action name="hello*" class="action.IndexAction" method="{1}">
<result name="success">/{1}login.jsp</result>
</action>
</package>
<!-- Add packages here -->
</struts>
分享到:
相关推荐
struts的基本配置,以及几个ACTION的区别,适合初学者
NULL 博文链接:https://qinglonghai.iteye.com/blog/569123
struts2基本配置使用手册
struts2基本配置,工程实践总结
这是struts2的基本配置,对struts2刚入门的同学可以参考一下。
本PPT描述了Struts的配置情况,同过此PPT读者可以容易的学会Struts的基本配置
NULL 博文链接:https://quicker.iteye.com/blog/613400
struts2的lib资源 struts2的基本配置
详细介绍了 struts2的配置 包括jar包的导入,xml文件的配置 Action类的写法等
struts2基本配置使用手册.非常详细,适合新手
struts动态验证登录示例程序,包括所有struts基本配置
struts2基本配置和一些必要的方法功能参考struts2连接数据库添加和显示
语言程序设计资料:struts2基本配置使用手册.doc
该demo是struts验证器validator使用,以及struts基本配置,自定义创建struts的验证器,使用maven创建管理工程,使用eclipse编译器
java-struts2基本配置使用手册.doc