现在项目需要,把struts的注解运用起来,调试老半天结果访问的时候提示no action mapping and action name login,,
我只是用了最简单的loginAction extends actionSupport,如果谁用到过,麻烦写个最简单的例子,包含struts的配置文件,web.xml的配置文件,以及action的写法,望大家不吝赐教,感激不尽
struts.xml convention相关配置
<constant name="struts.convention.default.parent.package" value="hrmmsys-core" />
<!-- 结果资源所在路径 -->
<constant name="struts.convention.result.path" value="/" />
<!--确定搜索包的路径。只要是结尾为action的包都要搜索。basePackage按照默认不用配置,如果配置,只会找以此配置开头的包。locators及locators.basePackage都是一组以逗号分割的字符串。 -->
<constant name="struts.convention.package.locators" value="action" />
<!-- action后缀 -->
<constant name="struts.convention.action.suffix" value="Action" />
<!-- 名称首字母小写 -->
<constant name="struts.convention.action.name.lowercase" value="true" />
<!-- 分隔符 一个action名字的获取。比如为HelloWorldAction。按照配置,actionName为hello-world。 -->
<constant name="struts.convention.action.name.separator" value="-" />
web.xml配置
Struts2
org.apache.struts2.dispatcher.FilterDispatcher
</filter>
<filter-mapping>
<filter-name>Struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
loginAction 在不使用注释的情况下访问应该是
login!method.action 路径访问