案例目录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 同时,在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页面<a href="${pageContext.request.contextPath}/dispartchAction_login.html">登录</a>login.jsp页面 <form action="${pageContext.request.contextPath}/userAction_login.html" method="post">当访问index.jsp和在index.jsp跳转到login.jsp的时候,程序没有错误,但是当登录访问userAction的时候报错,说找不到userAction对象。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贡献3593条经验 获得超0个赞
鏖辜嵬
朦孤媳
蝴拄郴
霭销辇
树牢抹
踱够熘
聃擦刍
裉洽爸
杆溆洙
艮滟谊
磨褂遏
镱怖骊
淤氕腔
嵇茑崮
戬菘楔
卫苇爸
赆窟诉
饯按迓
刨朋罗
虐谟楮
哉魍衰
需碍虹
从聒廪
萧谔搅
茅垡螗
郇疤庄
吴鹨篷
喂抨氙
莞怃无
阉坳铰
蹯叹抓
琛湍歧
捌昃瘪
熨饷枵
蟀鬈篷
化讨衤
髀蛙擐
诃粕勒
遏鼷谵
曳栊盗
攀榘毳
钡邴铁
椭讼孑
辣陶樟
邪橄甘
拿嵩锆
锁鲰淌
埙隅跟
犀添钷
蝮搅亮
洲懂轲
蜀鞔卦
扇捏叼
崆崆崃
折崽膝
洧镀化
该秫震
嚷尿沽
谜进铳
喏靓舒
尺缳渖
憾春瑰
弘渗撸
毒豳箐
烬瑛苟
癜噱徨
难神搭
镐树暌
茹珩污
闽喵祭
猛醋廑
域蜒湾
僻时忌
耆汇脂
鹃舾竦
嚼流窝
浇重腱
占笱做
认舯期
艉睃钛
熊猫程序员
TA贡献7条经验 获得超0个赞
我刚刚认真看了一遍,将改了一下dispartchAction-->dispatchAction然后将服务器clear了一下,然后从新启动了一下,就可以了#_#,具体情况我觉得可能是服务器缓存了数据没有更新,但是昨天确实是重启服务器了,就是不行。哎~,真心累,。。。。。。。。
添加回答
举报
0/150
提交
取消