SSH 很简单的问题 java.lang.RuntimeException 大侠们给看看

loveme_123 2011-03-26 04:16:32
[错误为:
java.lang.RuntimeException: Invalid action class configuration that references an unknown class named [updatePAction]
java.lang.ClassNotFoundException: updatePAction
配置为:
struts.xml
<action name="updatePStudent" class="updatePAction">
<result >updateStudentAction.action</result>
</action>
<action name="updateStudentAction" class="updateStudentAction">
<result type="redirect">/listStudent.action</result>
<result name="input">/update.jsp</result>
</action>


list.jsp
  <s:iterator value="#request.list" id="us" >
<tr>
<td><s:property value="#us.id"/></td>
<td><s:property value="#us.name"/></td>
<td><s:property value="#us.password"/></td>
<td><s:property value="#us.age"/></td>
<td><s:a href="deleteStudent.action?student.id=%{#us.id}" onclick="return dell();" >delete</s:a></td>
<td><s:a href="updatePStudent.action?student.id=%{#us.id}">update</s:a></td>
</tr>
</s:iterator>

applicationContext.xml
<bean id="updatePAction" class="action.updatePStudentAction" scope="prototype">
<property name="studentService" ref="studentService"/>
</bean>
<bean id="updateStudentAction" class="action.updateStudentAction" scope="prototype">
<property name="studentService" ref="studentService"/>
</bean>
...全文
137 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
sustbeckham 2011-03-26
  • 打赏
  • 举报
回复
[Quote=引用 9 楼 loveme_123 的回复:]

恩 问题解决了 是设计时逻辑出错了 在struts中 <action name="updateStudentAction" class="updateStudentAction"> class的值写成applicationContext 中bean 的ID值 是不是就算是告诉Action 有Spring 创建
[/Quote]
首先要有集成的struts2 spring的jar包,然后要在struts的配置文件中说明下
loveme_123 2011-03-26
  • 打赏
  • 举报
回复
恩 问题解决了 是设计时逻辑出错了 在struts中 <action name="updateStudentAction" class="updateStudentAction"> class的值写成applicationContext 中bean 的ID值 是不是就算是告诉Action 有Spring 创建
飞子 2011-03-26
  • 打赏
  • 举报
回复
同意楼上
sustbeckham 2011-03-26
  • 打赏
  • 举报
回复
你在struts。xml 有没显式的写 让spring去管理struts的action?
飞子 2011-03-26
  • 打赏
  • 举报
回复
<bean id="updatePAction" class="action.updatePStudentAction" scope="prototype">
<property name="studentService" ref="studentService"/>
</bean>
<bean id="updateStudentAction" class="action.updateStudentAction" scope="prototype">
<property name="studentService" ref="studentService"/>
</bean>

我认为 一个service应该对应一个action吧 你的两个action对应的是一个service
飞子 2011-03-26
  • 打赏
  • 举报
回复
你的studentService配置了没
飞子 2011-03-26
  • 打赏
  • 举报
回复
估计是action没有注入进去
loveme_123 2011-03-26
  • 打赏
  • 举报
回复
是对的
飞子 2011-03-26
  • 打赏
  • 举报
回复
<bean id="updatePAction" class="action.updatePStudentAction" scope="prototype">
<property name="studentService" ref="studentService"/>
</bean>

看看里面的class 的路径写对了没

67,513

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧