Java 没有为类型';定义结果类型;重定向操作';映射为名称';成功'; 资格预审 ${customerId} /jsp/getStarted.jsp /jsp/getStarted.jsp /jsp/preQualification.jsp /jsp/preQualification.jsp
使用Java 没有为类型';定义结果类型;重定向操作';映射为名称';成功'; 资格预审 ${customerId} /jsp/getStarted.jsp /jsp/getStarted.jsp /jsp/preQualification.jsp /jsp/preQualification.jsp,java,configuration,struts2,naming-conventions,camelcasing,Java,Configuration,Struts2,Naming Conventions,Camelcasing,使用struts2-core-2.0.12.jar可以正常工作,但在更新到struts2-core-2.1.6.jar后,出现以下错误: Caused by: There is no result type defined for type 'redirect-action' mapped with name 'success'. Did you mean 'redirectAction'? - result - file:/D:/eclipse-indigo/workspace/.metad
struts2-core-2.0.12.jar
可以正常工作,但在更新到struts2-core-2.1.6.jar
后,出现以下错误:
Caused by: There is no result type defined for type 'redirect-action' mapped with name 'success'. Did you mean 'redirectAction'? - result - file:/D:/eclipse-indigo/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/Fundation/WEB-INF/classes/struts.xml:19:54
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.buildResults(XmlConfigurationProvider.java:613)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addAction(XmlConfigurationProvider.java:364)
... 26 more
导致错误的原因是什么?您正在对操作重定向结果使用旧的符号。将
重定向操作
更改为重定向操作
自Struts2.1.0
以来,所有默认的结果名称和拦截器名称都已更改,从旧的脊椎病例
更改为新的驼峰病例
从:
与以前版本的向后兼容性问题
由于2.1.0
:所有默认结果名称和拦截器名称现在都是camelCase(例如was
重定向操作
,is重定向操作
)
在Struts 2.3.x中,一些代码被更改为重定向操作更改为重定向操作 所以你必须这样声明-
<action name="saveGetStarted" class="com.sample.action.GetStartedAction" method="save">
<interceptor-ref name="defaultStack"/>
<result name="success" type="redirectAction">
<param name="actionName">preQualification</param>
<param name="customerId">${customerId}</param>
</result>
<result name="input">/jsp/getStarted.jsp</result>
<result name="error">/jsp/getStarted.jsp</result>
</action>
<action name="preQualification" class="com.sample.action.PreQualificationAction" method="excute">
<result name="success">/jsp/preQualification.jsp</result>
<result name="input">/jsp/preQualification.jsp</result>
</action>
资格预审
${customerId}
/jsp/getStarted.jsp
/jsp/getStarted.jsp
/jsp/preQualification.jsp
/jsp/preQualification.jsp
我的想法是阅读错误消息。