今天做struts框架时,遇到了一些bug,做一下记录,第一个就是struts.xml配置时版本部队问题
报错界面:警告: Could not find action or result
No result defined for action org.easybooks.bookstore.action.LoginAction and result success
bug1:
错误的配置
正确的配置
struts-prepare
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
正确的配置是这样,但是郑阿奇的版本里面因为struts的版本不同导致 strut-prepare和strut-excute执行时出现报错的情况,导致界面直接404,进不了界面,或者登录界面输入值之后,直接404,综上都是因为struts版本不同导致的。
bug2:
login.jsp页面的action名称和struts页面的action名称出现不匹配的情况:
情况一:login.jsp页面错误,struts页面错误
报错界面:
情况二:login.jsp页面正确,struts页面错误:
struts的action名称此时还是小写
此时报错:
警告: Could not find action or result
There is no Action mapped for namespace / and action name Login. - [unknown location]
解决办法:统一struts.xml和login.jsp里action的名称,统一改成Login