我运行程序后报警告: Could not find action or result错误 但是我的action 和result 是存在的
struts。xml中的配置
<action name="problemsAction" class="problemsAction" method="add">
<result name="ok">/problems/ProblemsList.jsp</result>
<result name="error">/index.jsp</result>
</action>
<action name="problemsAction" class="problemsAction" method="load">
<result name="success">/problems/AnswerQuestion.jsp</result>
<result name="error">/Login/Error.jsp</result>
</action>
javaaition中的代码
public String add() throws Exception {
System.out.println("fsdddddddddd");
System.out.println(problems.getTitle());
problems.setTitle(problems.getTitle());
problems.setCategory(problems.getCategory());
problems.setScore(problems.getScore());
problems.setContent(problems.getContent());
problemsDAOImpl.add(problems);
list = problemsDAOImpl.pageQuery(10,1);
return "ok"; public String load(int id) throws Exception { problems=problemsDAOImpl.loadById(id); return SUCCESS;
}
}
我再没有改成return "ok"前是对的 但是只是貌似是队的 他其实是使用了load方法的返回
也就是 我在add()返回return SUCCESS; 时 在struts,xml中 他是调用的是<action name="problemsAction" class="problemsAction" method="load">
<result name="success">/problems/AnswerQuestion.jsp</result>
<result name="error">/Login/Error.jsp</result>
</action> 我不知道为什么 我add方法是执行到的 在线等 先谢谢各位了
struts。xml中的配置
<action name="problemsAction" class="problemsAction" method="add">
<result name="ok">/problems/ProblemsList.jsp</result>
<result name="error">/index.jsp</result>
</action>
<action name="problemsAction" class="problemsAction" method="load">
<result name="success">/problems/AnswerQuestion.jsp</result>
<result name="error">/Login/Error.jsp</result>
</action>
javaaition中的代码
public String add() throws Exception {
System.out.println("fsdddddddddd");
System.out.println(problems.getTitle());
problems.setTitle(problems.getTitle());
problems.setCategory(problems.getCategory());
problems.setScore(problems.getScore());
problems.setContent(problems.getContent());
problemsDAOImpl.add(problems);
list = problemsDAOImpl.pageQuery(10,1);
return "ok"; public String load(int id) throws Exception { problems=problemsDAOImpl.loadById(id); return SUCCESS;
}
}
我再没有改成return "ok"前是对的 但是只是貌似是队的 他其实是使用了load方法的返回
也就是 我在add()返回return SUCCESS; 时 在struts,xml中 他是调用的是<action name="problemsAction" class="problemsAction" method="load">
<result name="success">/problems/AnswerQuestion.jsp</result>
<result name="error">/Login/Error.jsp</result>
</action> 我不知道为什么 我add方法是执行到的 在线等 先谢谢各位了
解决方案 »
- 求助:大神们,给点建议吧。
- 怎么清空spring security中的值
- java.lang.IllegalArgumentException: XPP3 pull parser library not present???
- 数组循环逻辑问题
- WEB系统的Filter
- 请教各位大侠XFire问题?
- 包含数据库的程序打包失败
- 问大家个问题 搭建Spring框架 如果没网络 是不是第一次还要配置DTD文件 需要配置哪些DTD文件啊
- spring ModelAndView定向html页面
- (再发)请问为什么这个类运行会出错,是不是还要其他配置
- 请问正则表达式如何匹配多个字符串?
- HQL实现模糊匹配(在线等。。。)
<action name="problemsAction" class="problemsAction" method="add">
<result name="ok">/problems/ProblemsList.jsp</result>
<result name="error">/index.jsp</result>
</action>
<action name="problemsAction" class="problemsAction" method="load">
<result name="success">/problems/AnswerQuestion.jsp</result>
<result name="error">/Login/Error.jsp</result>
</action>
名字不能相同 还有没有<result name="input">/Error.jsp</result>