案例目錄spring.xml配置<!-- dispartchAction配置 --><bean id="dispartchAction" class="sshDemo1.action.DispatchAction"scope="prototype"></bean><!-- userAction配置 --><bean id="userAction" class="sshDemo1.action.UserAction"scope="prototype"></bean>struts配置<struts>?<constant name="struts.i18n.encoding" value="UTF-8"></constant>?<constant name="struts.action.extension" value="html"></constant>?<constant name="struts.enable.DynamicMethodInvocation" value="false"></constant>?<package name="packageDemo1" extends="struts-default" namespace="/">?<!-- 注意:在struts2.3以后使用通配符配置需要將struts.enable.DynamicMethodInvocation=false? ? ? ? ? 同時(shí),在package下配置global-allowed-methods或配置在action下配置allowed-methods? ?-->? <global-allowed-methods>login,index</global-allowed-methods>? <action name="dispartchAction_*" class="dispartchAction" method="{1}">? ?<result name="index">/WEB-INF/index.jsp</result>? ?<result name="login">/WEB-INF/login.jsp</result>? </action>? <action name="userAction_*" class="userAction" method="{1}">? ?<result name="success">/WEB-INF/success.jsp</result>? ?<result name="login">/WEB-INF/login.jsp</result>? </action>?</package></struts>web.xml配置? <context-param>? ?<param-name>contextConfigLocation</param-name>? ?<param-value>classpath:spring.xml</param-value>? </context-param>? <listener>? ?<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>? </listener>? <filter>? ?<filter-name>struts2</filter-name>? ?<filter-class>org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter</filter-class>? </filter>? <filter-mapping>? ?<filter-name>struts2</filter-name>? ?<url-pattern>/*</url-pattern>? </filter-mapping>index.jsp頁(yè)面<a href="${pageContext.request.contextPath}/dispartchAction_login.html">登錄</a>login.jsp頁(yè)面 <form action="${pageContext.request.contextPath}/userAction_login.html" method="post">當(dāng)訪問index.jsp和在index.jsp跳轉(zhuǎn)到login.jsp的時(shí)候,程序沒有錯(cuò)誤,但是當(dāng)?shù)卿浽L問userAction的時(shí)候報(bào)錯(cuò),說找不到userAction對(duì)象。HTTP Status 500 - Unable to instantiate Action, userAction, defined for 'userAction_login' in namespace '/'Cannot find class [sshDemo1.action.UserAction] for bean with name 'userAction' defined in class path resource [spring.xml]; nested exception is java.lang.ClassNotFoundException: sshDemo1.action.UserAction求解?謝謝?。?!。。。。
3 回答

慕的地6079101
TA貢獻(xiàn)3593條經(jīng)驗(yàn) 獲得超0個(gè)贊
鏖辜嵬
朦孤媳
蝴拄郴
靄銷輦
樹牢抹
踱夠熘
聃擦芻
裉洽爸
桿溆洙
艮滟誼
磨褂遏
鐿怖驪
淤氕腔
嵇蔦崮
戩菘楔
衛(wèi)葦爸
贐窟訴
餞按迓
刨朋羅
虐謨楮
哉魍衰
需礙虹
從聒廩
蕭諤攪
茅垡螗
郇疤莊
吳鷚篷
喂抨氙
莞憮無
閹坳鉸
蹯嘆抓
琛湍歧
捌昃癟
熨餉枵
蟀鬈篷
化討衤
髀蛙擐
訶粕勒
遏鼷譫
曳櫳盜
攀榘毳
鋇邴鐵
橢訟孑
辣陶樟
邪橄甘
拿嵩鋯
鎖鯫淌
塤隅跟
犀添钷
蝮攪亮
洲懂軻
蜀鞔卦
扇捏叼
崆崆崍
折崽膝
洧鍍化
該秫震
嚷尿沽
謎進(jìn)銃
喏靚舒
尺繯瀋
憾春瑰
弘滲擼
毒豳箐
燼瑛茍
癜噱徨
難神搭
鎬樹暌
茹珩污
閩喵祭
猛醋廑
域蜒灣
僻時(shí)忌
耆匯脂
鵑舾竦
嚼流窩
澆重腱
占笱做
認(rèn)舯期
艉脧鈦

熊貓程序員
TA貢獻(xiàn)7條經(jīng)驗(yàn) 獲得超0個(gè)贊
我剛剛認(rèn)真看了一遍,將改了一下dispartchAction-->dispatchAction然后將服務(wù)器clear了一下,然后從新啟動(dòng)了一下,就可以了#_#,具體情況我覺得可能是服務(wù)器緩存了數(shù)據(jù)沒有更新,但是昨天確實(shí)是重啟服務(wù)器了,就是不行。哎~,真心累,。。。。。。。。
添加回答
舉報(bào)
0/150
提交
取消