為什么我設(shè)置默認(rèn)ACTION系統(tǒng)出Struts Problem Report的問(wèn)題?求解。
我的代碼:
?<default-action-ref name="index"></default-action-ref>
?<action name="index">
<result>/index.jsp</result>
網(wǎng)頁(yè)報(bào)錯(cuò):
Struts Problem Report
Struts has detected an unhandled exception:
Messages: ? ?
com.imocc.action.adddaAction
Unable to instantiate Action, com.imocc.action.adddaAction, defined for 'addda' in namespace '/'com.imocc.action.adddaAction
? ?
File: ? ?org/apache/catalina/loader/WebappClassLoader.java ? ?
Line number: ? ?1,358 ? ?
2015-10-19
您好,index這個(gè)Action我沒(méi)看到,我猜應(yīng)該你在這個(gè)indexAction聲明了什么屬性。如果是默認(rèn)Action,Action對(duì)象實(shí)例在ActionContext對(duì)象實(shí)例之前創(chuàng)建的,所有這樣取得ActionContext容器對(duì)象就有可能會(huì)返回null,你可以檢查一下,也可以貼出來(lái)具體的Action代碼。?