日期:2014-05-19  浏览次数:20803 次

求解决Struts2在Action类里用Annotation,用DMI不能调用自定义方法
我用Struts2.1.8+Spring2.5.6+Hibernate3.3.1,在Action类里用Annotation方式,但发现用DMI方式调用自定义方法时不能调用而是直接返回值是input,就是“Result=input”,调用Action类里注释有@Override的方法就可以调用。想问下是什么原因!! 

就是调用register!userList不行 
调用注有@Override的input()就没问题 

@Controller
@Scope("prototype")
prototype
@ParentPackage(value = "struts-default")
@Results( { @Result(name = "success", location = "/success.jsp"),
@Result(name = "input", location = "/index.jsp"),
@Result(name = "list", location = "/userlist.jsp") })
public class RegisterAction extends ActionSupport {


@Override
public String execute() throws Exception {

  return "success";
}


public String userList(){

return "list";
}

@Override
public String input() throws Exception {

return "list";
}



}

------解决方案--------------------
register!userList.action