No result defined for action com.cobble.action.webfilter.LoginAction and result input
1.問題現象
DEBUG [geby:Errors on action com.cobble.action.webfilter.LoginAction@17414c8, returning result name 'input'] 2013-03-22 10:26:13,375 [com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor] -
ERROR [geby:Could not find action or result
/cobble/loginAlias.action] 2013-03-22 10:26:13,375 [org.apache.struts2.dispatcher.Dispatcher] -
No result defined for action com.cobble.action.webfilter.LoginAction and result input
struts-login.xml配置
1 <package name="login" extends="struts-default" namespace="/"> 2 <default-action-ref name="login"></default-action-ref> 3 <!--登錄--> 4 <action name="login" class="loginAction" method="login"> 5 <result name="login">/easyfoneWeb/jsp/frame/login.jsp</result> 6 <result name="success" type="redirectAction"> 7 <param name="actionName">index</param> 8 <param name="namespace">/frame</param> 9 </result> 10 </action> 11 </package>
2.解決方法----只需要閱讀4.1即可。
2.1此行【不正確】----{此處本人出現誤解,詳情請看4.1}
<action name="login" class="loginAction" method="login">
中的class,用的是spring3來統一管理的,貌似此處不可以。
訪問的時候,第一次可以訪問,正常的流程,debug的時候會進入到action里面去,但是第二次及以后訪問都不能進入到action中。
2.2需要改為action的完整限定名。即【正確】
<action name="login" class="com.cobble.action.login.LoginAction" method="login">
3.總結
網上還有可能的解決方法:1)action的特性name不能為login或者register等;2)存在LoginAction-validation.xml沒有驗證通過(http://struts.apache.org/release/2.3.x/docs/basic-validation.html)。
4.補充
4.1根據他人的回復,把spring配置改為如下【正確】,此時struts2-action可以按照原來的配置即【
<action name="login" class="loginAction" method="login">
】
1 <!-- 登錄 --> 2 <bean id="loginAction" class="com.cobble.action.login.LoginAction" scope="prototype"> 3 <property name="sysUserService" ref="sysUserService"/> 4 </bean>
4.1-A:原來的spring配置【不正確】
1 <!-- 登錄 --> 2 <bean id="loginAction" class="com.easyfone.action.login.LoginAction"> 3 <property name="sysUserService" ref="sysUserService"/> 4 </bean>
@Cobble HF.AH.CHN 2013-03-22