SSH整合报错:No result defined for action actions.RegisterAction and result input 20
我的struts.xml配置文件:<?xmlversion="1.0"encoding="UTF-8"?><!DOCTYPEstrutsPUBLIC"-//ApacheS...
我的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.devMode" value="true" />
<constant name="struts.i18n.encoding" value="utf-8"></constant>
<package name="struts2" extends="struts-default">
<!-- 验证码action配置 -->
<action name="imageCode" class="imageCode">
<result name="success" type="stream">
<param name="contentType">image/jpeg</param>
<param name="inputName">inputStream</param>
</result>
</action>
<!-- 登录action配置 -->
<action name="Login" class="login">
<result name="success">/index.jsp</result>
<result name="input">/jsp/login.jsp</result>
<result name="error">/jsp/error.jsp</result>
</action>
<!-- 配置注册action -->
<action name="register" class="register">
<result name="success">/jsp/register_varify.jsp</result>
<result name="input">/jsp/register.jsp</result>
</action>
</package>
</struts>
RegisterAction.java:
public String execute() throws Exception {
int tmp = -1;
ActionContext ac = ActionContext.getContext();
Map<String, Object> map = ac.getSession();
map.put("username", getUserName());
map.put("email", getEmail());
if (getUserType() == 1) {
tmp = this.userService.addUser(userName, password, email, false,
true);
}
if (getUserType() == 2) {
tmp = this.userService.addUser(userName, password, email, false,
false);
}
if (1== tmp) {
return SUCCESS;
} else {
this.clearActionErrors();
this.addActionError("注册失败,请重试!");
return INPUT;
}
}
log4j中的信息:
2013-04-27 19:19:15,316 - org.apache.struts2.convention.ConventionUnknownHandler -20213 [http-bio-8080-exec-4] DEBUG - Trying to locate the correct result for the FQ action [/register] with an file extension of [jspx] in the directory [/WEB-INF/content/] and a result code of [input]
2013-04-27 19:19:15,316 - org.apache.struts2.convention.ConventionUnknownHandler -20213 [http-bio-8080-exec-4] DEBUG - Checking ServletContext for [/WEB-INF/content/register-input.jspx]
2013-04-27 19:19:15,316 - org.apache.struts2.convention.ConventionUnknownHandler -20213 [http-bio-8080-exec-4] DEBUG - Checking ClasLoader for /WEB-INF/content/register-input.jspx
2013-04-27 19:19:15,316 - org.apache.struts2.convention.ConventionUnknownHandler -20213 [http-bio-8080-exec-4] DEBUG - Checking ServletContext for [/WEB-INF/content/register.jspx]
2013-04-27 19:19:15,317 - org.apache.struts2.convention.ConventionUnknownHandler -20214 [http-bio-8080-exec-4] DEBUG - Checking ClasLoader for /WEB-INF/content/register.jspx
2013-04-27 19:19:15,317 - org.apache.struts2.convention.ConventionUnknownHandler -20214 [http-bio-8080-exec-4] DEBUG - Checking ServletContext for [/WEB-INF/content/input.jspx]
我很不理解,为什么Struts会在/WEB-INF/content/路径下查找,我明明有配置success和input,但是为什么找不到呢?
还有我在JSP页面提交的数据已经可以插入数据库 展开
<?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.devMode" value="true" />
<constant name="struts.i18n.encoding" value="utf-8"></constant>
<package name="struts2" extends="struts-default">
<!-- 验证码action配置 -->
<action name="imageCode" class="imageCode">
<result name="success" type="stream">
<param name="contentType">image/jpeg</param>
<param name="inputName">inputStream</param>
</result>
</action>
<!-- 登录action配置 -->
<action name="Login" class="login">
<result name="success">/index.jsp</result>
<result name="input">/jsp/login.jsp</result>
<result name="error">/jsp/error.jsp</result>
</action>
<!-- 配置注册action -->
<action name="register" class="register">
<result name="success">/jsp/register_varify.jsp</result>
<result name="input">/jsp/register.jsp</result>
</action>
</package>
</struts>
RegisterAction.java:
public String execute() throws Exception {
int tmp = -1;
ActionContext ac = ActionContext.getContext();
Map<String, Object> map = ac.getSession();
map.put("username", getUserName());
map.put("email", getEmail());
if (getUserType() == 1) {
tmp = this.userService.addUser(userName, password, email, false,
true);
}
if (getUserType() == 2) {
tmp = this.userService.addUser(userName, password, email, false,
false);
}
if (1== tmp) {
return SUCCESS;
} else {
this.clearActionErrors();
this.addActionError("注册失败,请重试!");
return INPUT;
}
}
log4j中的信息:
2013-04-27 19:19:15,316 - org.apache.struts2.convention.ConventionUnknownHandler -20213 [http-bio-8080-exec-4] DEBUG - Trying to locate the correct result for the FQ action [/register] with an file extension of [jspx] in the directory [/WEB-INF/content/] and a result code of [input]
2013-04-27 19:19:15,316 - org.apache.struts2.convention.ConventionUnknownHandler -20213 [http-bio-8080-exec-4] DEBUG - Checking ServletContext for [/WEB-INF/content/register-input.jspx]
2013-04-27 19:19:15,316 - org.apache.struts2.convention.ConventionUnknownHandler -20213 [http-bio-8080-exec-4] DEBUG - Checking ClasLoader for /WEB-INF/content/register-input.jspx
2013-04-27 19:19:15,316 - org.apache.struts2.convention.ConventionUnknownHandler -20213 [http-bio-8080-exec-4] DEBUG - Checking ServletContext for [/WEB-INF/content/register.jspx]
2013-04-27 19:19:15,317 - org.apache.struts2.convention.ConventionUnknownHandler -20214 [http-bio-8080-exec-4] DEBUG - Checking ClasLoader for /WEB-INF/content/register.jspx
2013-04-27 19:19:15,317 - org.apache.struts2.convention.ConventionUnknownHandler -20214 [http-bio-8080-exec-4] DEBUG - Checking ServletContext for [/WEB-INF/content/input.jspx]
我很不理解,为什么Struts会在/WEB-INF/content/路径下查找,我明明有配置success和input,但是为什么找不到呢?
还有我在JSP页面提交的数据已经可以插入数据库 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询