struts2 标签异常 filtermapping配置

来源:百度知道 编辑:UC知道 时间:2024/06/16 04:24:05
为什么我将WEB.XML改成这样的话:
<url-pattern>*.action</url-pattern>

然后在页面中用标签就出现错误:
错误提示如下:
The Struts dispatcher cannot be found. This is usually caused by using Struts tags without the associated filter. Struts tags are only usable when the request has passed through its servlet filter, which initializes the Struts dispatcher needed for this tag. - [unknown location]

改成<url-pattern>/*</url-pattern>就不会出错!
但我现在应为需要需要用第一种方法。我记得刚学的时候是可以用第一种的啊。不知道为什么现在一用就出错。还请高人指点啊!!

/*.action试试

你试一下这样写行不?
<url-pattern>/teacher!addteacher.action</url-pattern>
teacher代表你的项目名,也是你的action的名字(struts.xml中设置的),addteacher.action是具体你要应用的那个action的名字,中间用!分隔.