struts2的那些坑之we.xml配置
struts2默认结尾应该是.action
如果你是配置*.action
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>*.action</url-pattern>
</filter-mapping>
jsp中只要写 name.action就可以访问了。
如果你是配置*.do
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>*.do</url-pattern>
</filter-mapping>
必须在struts.xml中配置
<constant name="struts.action.extension" value="do" />
jsp中只要写 name.do就可以访问了。
如果你在struts.xml中配置
<constant name="struts.action.extension" value="do,action" />
jsp中只要写 name.do可以访问了。
jsp中只要写 name.action不能访问了。
如果你是配置/*
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
jsp中只要写 name就可以访问
jsp中只要写 name.action也可以访问
jsp中只要写 name.do不能访问
但是name.html之类的不能访问
如果你在struts.xml中配置
<constant name="struts.action.extension" value="do,action" />
jsp中只要写 name.do可以访问了。
jsp中只要写 name.action也可以访问了。
但是name.html之类的不能访问
配置/*.do或者/*.action
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*.do</url-pattern>
</filter-mapping>
tomcat根本无法启动(这个不知道是怎么就出来了这种配置)
总结一下
struts.xml中应该有类似这样的配置
<constant name="struts.action.extension" value="action" />
如果我们不重写这个就会默认是action
如果我们重写这个配置
那么web.xml的拦截就必须是出现在value里面的某个值
struts2是灵活,灵活的让人崩溃。错误只是404,根本就不知道怎么出的问题。
/* 和 *.do的区别
具体不太了解,我的猜想是:
/*是rest风格的写法
*.do是传统写法
*.do有个优点是,拦截的数量比较少,比如css之类的都不会拦截
/*是不是需要根springmvc一样处理静态资源问题????
分享到:
相关推荐
Struts框架中struts-config.xml文件配置小结
struts-config.xml struts标准配置文件 struts-config
struts.xml和applicationContext.xml、web.xml的配置
struts2中两种validation.xml的配置方式
spring在web.xml中和在struts中的不同配置..pdf
struts-config.xml配置文件 struts-config.xml配置文件 struts-config.xml配置文件
SSH之Struts1之struts-config.xml常用配置详解(3-21-2008)
struts.xml文件配置解释,对action配置进行说明
struts.xml配置文件详解struts.xml配置文件详解struts.xml配置文件详解
Struts-config.xml配置详解,介绍Struts-config中8个元素配置方法。
struts2-core-2.0.1.jar, struts2-core-2.0.11.1.jar, struts2-core-2.0.11.2.jar, struts2-core-2.0.11.jar, struts2-core-2.0.12.jar, struts2-core-2.0.14.jar, struts2-core-2.0.5.jar, struts2-core-2.0.6.jar,...
struts1 web.xml struts1配置
struts-config.xml配置文件对学struts的人必备的查找资料。
以前和struts2一起使用的配置文件,struts2的核心控制器
SSH(Struts,Spring,Hibernate)struts.xml文件配置
绝对的好东西 struts2.0中struts.xml配置文件详解
韩顺平视频配套struts-config.xml配置详解.txt
Struts-config.xml 配置详解.doc Struts-config.xml 配置详解.doc
struts-config.xml配置文件详解
这个strut-config配置详解是韩顺平老师指定的 很多同学都看过韩老师的视频或者上过韩老师的课程吧