小弟使用是struts2.0 spring2.0 hibernate框架
在跳转action时控制台页面报错:
2008-10-12 15:35:36,987 INFO [com.opensymphony.xwork2.validator.ActionValidatorManagerFactory] - <Detected AnnotationActionValidatorManager, initializing it...>
2008-10-12 15:35:37,549 ERROR [org.apache.struts2.dispatcher.Dispatcher] - <Could not find action or result>
No result defined for action com.hy.action.InvestAction and result input - action - file:/D:/tomcat/Tomcat%205.5/webapps/PMS_SSH_2008_10_06/WEB-INF/classes/struts.xml:15:54
at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:345)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:150)
at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:48)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218)
........
jsp页面代码</head><body>
<form id="investform" action="invest!investSave.action" method="post">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="page-positon-td">xxxxx</td>
</tr>
<tr>
<td class="boxoff_td">
<table cellpadding="0" cellspacing="0" class="table-lt-border">
<tr>
<td class="list-header-td">xxxxxx<input type="button" class="btn-7word" value="项目信息及专业" onclick="showDiv()">
</td>
</tr>
<td>
<table>
<tr>
<td width="200" class="list-left-title">年份</td>
<td width="200" class="info-left-td">
<select id="year" name="txplaninfo.year">
<option>年份</option>
<option value="2005">2005</option>
<option value="2006">2006</option>
<option value="2007">2007</option>
<option value="2008">2008</option>
<option value="2009">2009</option>
<option value="2010">2010</option>
<option value="2011">2011</option>
</select></td>
。。
</table>
</form>
</body>
</html>
struts-xml文件代码:
<struts>
<constant name="struts.i18n.encoding" value="gb2312"></constant>
<package name="default" extends="struts-default">
<action name="invest" class="investAction">
<result name="investpage">/investment/plan/investment.plan.invest.jsp</result>
<result name="success">/success.jsp</result>
</action>
</package>
</struts> applicationContext.xml文件代码:<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<bean id="investAction" class="com.hy.action.InvestAction" scope="prototype">
<property name="investActionService">
<ref bean="investActionService"/>
</property>
</bean>
</beans>
InvestAction类代码:
public class InvestAction extends ActionSupport {
..........
private Txplanproj txplanproj;
private Txplaninfo txplaninfo;
//把从表单里拿的资料放到数据库中
public String investSave(){
System.out.println("investSave!!!");
System.out.println(txplanproj.getName());
Txplaninfo txplaninfo = new Txplaninfo();
System.out.println(txplaninfo.getArea());
return "success";
}
public Txplanproj getTxplanproj() {
return txplanproj;
}
public void setTxplanproj(Txplanproj txplanproj) {
this.txplanproj = txplanproj;
}
public Txplaninfo getTxplaninfo() {
return txplaninfo;
}
public void setTxplaninfo(Txplaninfo txplaninfo) {
this.txplaninfo = txplaninfo;
}
}
在跳转action时控制台页面报错:
2008-10-12 15:35:36,987 INFO [com.opensymphony.xwork2.validator.ActionValidatorManagerFactory] - <Detected AnnotationActionValidatorManager, initializing it...>
2008-10-12 15:35:37,549 ERROR [org.apache.struts2.dispatcher.Dispatcher] - <Could not find action or result>
No result defined for action com.hy.action.InvestAction and result input - action - file:/D:/tomcat/Tomcat%205.5/webapps/PMS_SSH_2008_10_06/WEB-INF/classes/struts.xml:15:54
at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:345)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:150)
at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:48)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218)
........
jsp页面代码</head><body>
<form id="investform" action="invest!investSave.action" method="post">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="page-positon-td">xxxxx</td>
</tr>
<tr>
<td class="boxoff_td">
<table cellpadding="0" cellspacing="0" class="table-lt-border">
<tr>
<td class="list-header-td">xxxxxx<input type="button" class="btn-7word" value="项目信息及专业" onclick="showDiv()">
</td>
</tr>
<td>
<table>
<tr>
<td width="200" class="list-left-title">年份</td>
<td width="200" class="info-left-td">
<select id="year" name="txplaninfo.year">
<option>年份</option>
<option value="2005">2005</option>
<option value="2006">2006</option>
<option value="2007">2007</option>
<option value="2008">2008</option>
<option value="2009">2009</option>
<option value="2010">2010</option>
<option value="2011">2011</option>
</select></td>
。。
</table>
</form>
</body>
</html>
struts-xml文件代码:
<struts>
<constant name="struts.i18n.encoding" value="gb2312"></constant>
<package name="default" extends="struts-default">
<action name="invest" class="investAction">
<result name="investpage">/investment/plan/investment.plan.invest.jsp</result>
<result name="success">/success.jsp</result>
</action>
</package>
</struts> applicationContext.xml文件代码:<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<bean id="investAction" class="com.hy.action.InvestAction" scope="prototype">
<property name="investActionService">
<ref bean="investActionService"/>
</property>
</bean>
</beans>
InvestAction类代码:
public class InvestAction extends ActionSupport {
..........
private Txplanproj txplanproj;
private Txplaninfo txplaninfo;
//把从表单里拿的资料放到数据库中
public String investSave(){
System.out.println("investSave!!!");
System.out.println(txplanproj.getName());
Txplaninfo txplaninfo = new Txplaninfo();
System.out.println(txplaninfo.getArea());
return "success";
}
public Txplanproj getTxplanproj() {
return txplanproj;
}
public void setTxplanproj(Txplanproj txplanproj) {
this.txplanproj = txplanproj;
}
public Txplaninfo getTxplaninfo() {
return txplaninfo;
}
public void setTxplaninfo(Txplaninfo txplaninfo) {
this.txplaninfo = txplaninfo;
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货