错误: 11:44:40,640 ERROR Dispatcher:515 - Could not find action or result No result defined for action www.account.people.struts.TestAction and result input - action - file:/E:/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/webapps/account/WEB-INF/classes/config/struts/people/people-struts.xml:23:56 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) ....
代码如下:
jsp代码: <%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Insert title here </title> </head> <body> <form action=" <%=request.getContextPath()%>/test/toGo.shtml" method="post"> str: <input type="text" name="str" id = "str"> time: <input type="text" name="timee" id="timee"> <input type="submit" value="提交"> </form> </body> </html>
Action代码: public class TestAction extends BaseAction {
private Date timee; private String str; private String times;
public String toGo(){ System.out.println(times); return super.SUCCESS; } public String getStr() { return str; }
public void setStr(String str) { this.str = str; }
public Date getTimee() { return timee; }
public void setTimee(Date timee) { this.timee = timee; }
public String getTimes() { return times; }
public void setTimes(String times) { this.times = times; } }