HTTP Status 404 - No result defined for action com.project.web.action.PersonAction and result succ
typeStatusreportmessageNoresultdefinedforactioncom.project.web.action.PersonActionand...
type Status report
message No result defined for action com.project.web.action.PersonAction and result success
description The requested resource (No result defined for action com.project.web.action.PersonAction and result success) is not available.
在我的项目里配置了hibernate和struts2,运行的时候出现了这样的错误。
我的struts.xml配置文件是这样子的:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd">
<struts>
<constant name="struts.il8n.encoding" value="UTF-8"></constant>
<constant name="struts.ui.theme" value="simple"></constant>
<package name="default" namespace="/" extends="struts-default">
<action name="person" class="com.project.web.action.PersonAction">
<result name="success" type="redirectAction">log</result>
<result name="fail">page/login_struts2.jsp</result>
<result name="manage">/page/manage.jsp</result>
<result name="input">/page/register.jsp</result>
</action>
<action name="log" class="com.project.web.action.PersonAction">
<result name="success">/page/manage.jsp</result>
</action>
</package>
</struts>
我的action是这样的:
public String login() {
Map<String, Object> request = (Map<String, Object>) ActionContext
.getContext().get("request");
Person pn = biz
.searchPerson(person.getUsername(), person.getPassword());
if (pn == null) {
request.put("message", "登录失败");
return "fail";
} else {
request.put("message", "登录成功");
return SUCCESS;
}
}
它进入了action,运行最后报了错。求大神。 展开
message No result defined for action com.project.web.action.PersonAction and result success
description The requested resource (No result defined for action com.project.web.action.PersonAction and result success) is not available.
在我的项目里配置了hibernate和struts2,运行的时候出现了这样的错误。
我的struts.xml配置文件是这样子的:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd">
<struts>
<constant name="struts.il8n.encoding" value="UTF-8"></constant>
<constant name="struts.ui.theme" value="simple"></constant>
<package name="default" namespace="/" extends="struts-default">
<action name="person" class="com.project.web.action.PersonAction">
<result name="success" type="redirectAction">log</result>
<result name="fail">page/login_struts2.jsp</result>
<result name="manage">/page/manage.jsp</result>
<result name="input">/page/register.jsp</result>
</action>
<action name="log" class="com.project.web.action.PersonAction">
<result name="success">/page/manage.jsp</result>
</action>
</package>
</struts>
我的action是这样的:
public String login() {
Map<String, Object> request = (Map<String, Object>) ActionContext
.getContext().get("request");
Person pn = biz
.searchPerson(person.getUsername(), person.getPassword());
if (pn == null) {
request.put("message", "登录失败");
return "fail";
} else {
request.put("message", "登录成功");
return SUCCESS;
}
}
它进入了action,运行最后报了错。求大神。 展开
1个回答
展开全部
<result name="success" type="redirectAction">log</result>
<result name="fail">page/login_struts2.jsp</result>
log和page/login_struts2.jsp前面是否需要加“/”
<result name="fail">page/login_struts2.jsp</result>
log和page/login_struts2.jsp前面是否需要加“/”
追问
不是这个问题,那个是我写错了,但是我根本就不让他跳到这里面来。不过还是谢谢你,我解决了。是因为action name="person" class="com.project.web.action.PersonAction">的person名字的问题。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询