maven 搭建 struts2 常见错误总结
1. tomcat启动的时候报错: Unable to load configuration. - [unknown location]
这里分两种情况:
1) 指定目录下 /src/main/resources/下 没有找到struts.xml文件
2) /src/main/resources/struts.xml虽然存在,但是该配置文件有错误,虽然常见的配置错误,编译器会提示. 但是如果sturts.xml中有
<constant name="struts.objectFactory" value="spring" />
但是项目中却没有正确配置spring的时候,也会报错.
2. 访问页面报:There is no Action mapped for namespace [/] and action name [sayHelloAction] associated with context path [/ssdemo].
这是没有有效的action配置对应导致的! 导致这个问题的原因要么是action本身就没有配置,要么是配置了,但是struts.xml的错误,导致action没有被有效加载!
持续学习、持续收获才能带来持续的满足和快乐!
浙公网安备 33010602011771号