添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
1、登陆页面是通过jquery easyui做的,控制层是spring做的,现在就是输入用户名和密码提交页面表单到spring controller,在controller里跳转到主菜单页面,而不是通过controller返回值到login.jsp,再从login.jsp路到主菜单页面。
login.jsp代码如下:
<html>
<head>
<base href="<%=basePath%>">
<title>UserLogin</title>
<script type="text/javascript">
$(function(){
$('#form').form({
url:'<%=path%>/login.dox',
onSubmit: function(){
var flag=$('#form').form('validate');
return flag;
}
});
$('#login').panel({
title:'adsfasdf',
width:400,
height:500,
border:true
})
});
</script>
</head>
<body>
<div align="center">
<form id="form" method="post">
<table id="login" width="400" class="datagrid-toolbar1">
<tr>
<td height="50" align="center">
userName:
</td>
<td>
<input id="login_name" type="text" name="login_name"
class="easyui-validatebox">
</td>
</tr>
<tr>
<td height="50" align="center">
password:
</td>
<td>
<input id="login_pwd" type="password" name="login_pwd"
class="easyui-validatebox">
</td>
</tr>
<tr>
<td align="center" colspan="2">
<input type="submit" value="login"
style="width: 80px; height: 25px;">
<input type="button" id="reset" value="reset"
style="width: 80px; height: 25px;" />
</td>
</tr>
</table>
</form>
</div>
</body>
</html>


spring controller代码如下:
@RequestMapping("/login.dox")
public ModelAndView login(HttpServletRequest request,
HttpServletResponse response) throws Exception {
ModelAndView mav = null;
boolean flag = false;
User bean = new User();
String pwd = "";
try {

bean.setLogin_name(request.getParameter("login_name"));
bean.setLogin_pwd(request.getParameter("login_pwd"));
if (StringUtil.isEmpty(bean.getLogin_name())) {
request.setAttribute("login_name", "* 登陆用户名检查失败!");
flag = true;
}

if (StringUtil.isEmpty(bean.getLogin_pwd())) {
request.setAttribute("login_pwd", "* 登陆密码检查失败!");
flag = true;
}

if (flag) {
return this.init(request, response);
}

int rsCount = employeeService.isExists(bean);

if (rsCount == 0) {
return this.init(request, response);
}
pwd = MD5.MD5Encode(bean.getLogin_pwd());
bean = (User) employeeService.Load(bean);

if (!pwd.equals(bean.getLogin_pwd())) {
request.setAttribute("login_pwd", "*用户不正确!");
return this.init(request, response);
}
HttpSession session = request.getSession();
session.setAttribute("userInfo", bean);
mav = new ModelAndView("/main/index"); //该地方指定跳转到主菜单页面。

} catch (Exception ex) {
ex.printStackTrace();
return this.init(request, response);
}
return mav;
}

实际情况中无法通过spring的controller跳转
请大家帮忙

success:function(data){ if (data.success == 'false') { $.messager.alert('提示',data.msg,'info'); }else{ location.href = 'main/index';



controller返回个map
map.put("success", "true");
map.put("msg", "消息");