在练习SSH2整合的时候,遇到了此问题,上网找了很久的答案,都不行..求高人相助!
Invalid action class configuration that references an unknown class named [PostTopics]
有的人说是ApplicationContext.xml或struts.xml配置错误 ,但是我在做前面一些功能的时候配置都没有错误!
struts.xml:
<action name="UserLoginAction" class="UserLogin">
<result name="success" type="chain">GetTopicAction</result>
<result name="error">/login.jsp</result>
</action>
<action name="GetTopicAction" class="GetAllTopics">
<result name="success">/youke.jsp</result>
<result name="error">/login.jsp</result>
</action>
<action name="TopicDetailsAction" class="TopicDetails">
<result name="success">/topicdetails.jsp</result>
<result name="error">/youke.jsp</result>
</action>
<action name="LoginOutAction" class="LoginOut" >
<result name="success" type="chain">GetTopicAction</result>
<result name="error">/youke.jsp</result>
</action>
<action name="PostTopicsAction" class="PostTopics">
<result name="SUCCESS" type="chain">GetTopicAction</result>
</action>
但是做发帖和回帖的功能的时候 报错了:
Invalid action class configuration that references an unknown class named [PostTopics]
都是相同的错误,说的好像是类没有被编译,甚是奇怪???刚启动工具的时候 居然可以运行正确,但是一会儿又不行了,
为什么呢?
发帖Action:
public String execute() throws Exception {
System.out.println(this.userId+topics.getContent()+topics.getTitle());
topics.getUsers().setUid(userId);
tbiz.postTopic(this.topics);
return super.SUCCESS;
}
还请高人相助!谢谢!
------解决方案--------------------你的类有放到包里吗?
------解决方案--------------------Invalid action class configuration that references an unknown class named [PostTopics]
无效的action构造因为涉及到未知的class[PostTopics]
<action name="PostTopicsAction" class="PostTopics">
<result name="SUCCESS" type="chain">GetTopicAction</result>
</action>
跳转到另一个action type应该为type="redirectAction"
------解决方案--------------------Invalid action class configuration that references an unknown class named [PostTopics]
<action name="PostTopicsAction" class="PostTopics">
<result name="SUCCESS" type="chain">GetTopicAction</result>
</action>
红色的那个东西,是类么?我总觉得这样命名不合适啊。。。
总之class="这里放的是包名加类名"