“注册”点击后报404错误

qq_超超 2017-05-06 10:56:43
用Spring+SpringMVC+Hibernate做注册登录页面中遇到,点击“注册”页面报404错误

(1) 这是我登录页面上的“注册”按钮,点击后跳转至Controller文件
<a href="<%=basePath%>doreg"
class="btn btn-success btn-small">注册</a>


(2)Controller文件如下,让页面跳转至/account/reg/register.jsp:
@ResponseBody
@RequestMapping(value = "/doreg",method = RequestMethod.GET)
public ModelAndView doreg(String name,String username,String password,HttpSession session ){
ModelAndView mav = initModelAndView();
mav.setView(new RedirectView(ChangLiang.LOCAL_PATH
+ "/account/reg/register.jsp"));
return mav;
}
(3)register.jsp如下:
<%@ page language="java" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<HTML xmlns="http://www.w3.org/1999/xhtml">
<HEAD>
<META content="IE=11.0000" http-equiv="X-UA-Compatible">

<META http-equiv="Content-Type" content="text/html; charset=utf-8">
<TITLE>换书网注册页面</TITLE>
<SCRIPT src="js/jquery.min.js" type="text/javascript"></SCRIPT>
<script type="text/javascript">
$(function(){
var validate = $("#useradd").validate({
rules:{
password:{
required:true
},
password1:{
required:true,
equalTo: ".password"
},
name : {
required : true
},
username : {
required : true
}
},
messages:{
password:{
require:"*请输入密码"
},
password1:{
require:"*请输入密码",
equalTo: "*两次密码输入不同!"
},
name:{
require:"*请输入姓名"
},
username:{
require:"*请输入账号!"
},
},

showErrors: function(errorMap, errorList) {
$.each(this.successList, function(index, value) {
return $("."+value.name).popover("hide");
});
$.each(errorList, function(index, value) {
var _popover;
_popover = $("."+value.element.name).popover({
trigger: "manual",
placement: "right",
content: value.message,
template: "<div style=\"height:30px;\" class=\"popover\"><div class=\"arrow\"></div><div style=\"height:30px;\" class=\"popover-inner\"><div style=\"height:30px; padding: 5px 14px;\" class=\"popover-content\"><p></p></div></div></div>"
});
_popover.popover("show");
$(value.element).addClass('has-error');

});
}

});
});
</script>
<STYLE>
body {
background: #ebebeb;
font-family: "Helvetica Neue", "Hiragino Sans GB", "Microsoft YaHei",
"\9ED1\4F53", Arial, sans-serif;
color: #222;
font-size: 12px;
}

* {
padding: 0px;
margin: 0px;
}

.top_div {
background: #008ead;
width: 100%;
height: 400px;
}

.ipt {
border: 1px solid #d3d3d3;
padding: 10px 10px;
width: 290px;
border-radius: 4px;
padding-left: 35px;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
-webkit-transition: border-color ease-in-out .15s, -webkit-box-shadow
ease-in-out .15s;
-o-transition: border-color ease-in-out .15s, box-shadow ease-in-out
.15s;
transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s
}

.ipt:focus {
border-color: #66afe9;
outline: 0;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px
rgba(102, 175, 233, .6);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px
rgba(102, 175, 233, .6)
}



.sel {
border: 1px solid #d3d3d3;
padding: 10px 10px;
width: 330px;
border-radius: 4px;
padding-left: 35px;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
-webkit-transition: border-color ease-in-out .15s, -webkit-box-shadow
ease-in-out .15s;
-o-transition: border-color ease-in-out .15s, box-shadow ease-in-out
.15s;
transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s
}

.sel:focus {
border-color: #66afe9;
outline: 0;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px
rgba(102, 175, 233, .6);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px
rgba(102, 175, 233, .6)
}

.u_logo {
background: url("images/username.png") no-repeat;
padding: 10px 10px;
position: absolute;
top: 12px;
left: 40px;
}

.p_logo {
background: url("images/password.png") no-repeat;
padding: 10px 10px;
position: absolute;
top: 12px;
left: 40px;
}

a {
text-decoration: none;
}

.tou {
background: url("images/tou.png") no-repeat;
width: 97px;
height: 92px;
position: absolute;
top: -87px;
left: 140px;
}

.left_hand {
background: url("images/left_hand.png") no-repeat;
width: 32px;
height: 37px;
position: absolute;
top: -38px;
left: 150px;
}

.right_hand {
background: url("images/right_hand.png") no-repeat;
width: 32px;
height: 37px;
position: absolute;
top: -38px;
right: -64px;
}

.initial_left_hand {
background: url("images/hand.png") no-repeat;
width: 30px;
height: 20px;
position: absolute;
top: -12px;
left: 100px;
}

.initial_right_hand {
background: url("images/hand.png") no-repeat;
width: 30px;
height: 20px;
position: absolute;
top: -12px;
right: -112px;
}

.left_handing {
background: url("images/left-handing.png") no-repeat;
width: 30px;
height: 20px;
position: absolute;
top: -24px;
left: 139px;
}

.right_handinging {
background: url("images/right_handing.png") no-repeat;
width: 30px;
height: 20px;
position: absolute;
top: -21px;
left: 210px;
}
</STYLE>

<SCRIPT type="text/javascript">
$(function() {
//得到焦点
$("#password").focus(function() {
$("#left_hand").animate({
left : "150",
top : " -38"
}, {
step : function() {
if (parseInt($("#left_hand").css("left")) > 140) {
$("#left_hand").attr("class", "left_hand");
}
}
}, 2000);
$("#right_hand").animate({
right : "-64",
top : "-38px"
}, {
step : function() {
if (parseInt($("#right_hand").css("right")) > -70) {
$("#right_hand").attr("class", "right_hand");
}
}
}, 2000);
});
//失去焦点
$("#password").blur(function() {
$("#left_hand").attr("class", "initial_left_hand");
$("#left_hand").attr("style", "left:100px;top:-12px;");
$("#right_hand").attr("class", "initial_right_hand");
$("#right_hand").attr("style", "right:-112px;top:-12px");
});
});
</SCRIPT>

<META name="GENERATOR" content="MSHTML 11.00.9600.17496">
</HEAD>

<BODY>


<form class="form-horizontal" method="post" action="<%=basePath%>reg"
name="basic_validate" id="useradd">
<c:if test="${u!=null}">
<input type="hidden" name="id" value="${u.id}">
</c:if>

<div class="control-group">
<label class="control-label">姓名/名称</label>
<div class="controls">
<input type="text" name="name" class="name" value="">
</div>
</div>

<div class="control-group">
<label class="control-label">用户名</label>
<div class="controls">
<input type="text" name="username" class="username" value="">
</div>
</div>



<div class="control-group">
<label class="control-label">密码</label>
<div class="controls">
<input type="text" name="password" class="password"
value="">
</div>
</div>

<div class="control-group">
<label class="control-label">密码确认</label>
<div class="controls">
<input type="text" class="password1"
value="" name="password1">
</div>
</div>


<DIV
style="height: 50px; line-height: 50px; margin-top: 30px; border-top-color: rgb(231, 231, 231); border-top-width: 1px; border-top-style: solid;">
<P style="margin: 5px 35px 20px 45px;">
<SPAN
style="float:ringt;">
<input
style="margin-top:8px; background: rgb(0, 142, 173); padding: 7px 10px; border-radius: 4px; border: 1px solid rgb(26, 117, 152); border-image: none; color: rgb(255, 255, 255); font-weight: bold;"
value="注册" type="submit"/> </SPAN>

<!--
<SPAN style="margin-left:50px;">

<input
style="margin-top:8px; background: rgb(0, 142, 173); padding: 7px 10px; border-radius: 4px; border: 1px solid rgb(26, 117, 152); border-image: none; color: rgb(255, 255, 255); font-weight: bold;"
value="注册" type="button"/>
</SPAN>
-->
<span class="rightbuttom"><a
href="<%=basePath%>login"
class="btn btn-success btn-small">返回</a></span>
</P>
</DIV>
</form>
</BODY>
</HTML>



我是逻辑有误吗?它怎么没有正确返回注册页面,各位大神,能看看不?
...全文
154 回复 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

10,612

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 其他
社区管理员
  • 其他
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧