电信资费管理系统 ssm框架写后台
1.登录
登录输入用户名,密码,验证码,输入的用户名,密码,验证码从后台进行验证,用户名,密码会通过sql语句在数据库中进行查询。
前端jsp
<body class="index">
<div class="login_box">
<form action="user/login" method="post" onsubmit="return checkForm()" class="main_form">
<table>
<tr>
<td class="login_info">账号:</td>
<td colspan="2"><input name="username" type="text" class="width150" id="userName" onblur="userNameBlur()"/></td>
<td class="login_error_info"><font color="#FF0000"><span class="required" id="userNameId"></span></font></td>
</tr>
<tr>
<td class="login_info">密码:</td>
<td colspan="2"><input name="password" type="password" class="width150" id="pwd" onblur="pwdBlur()" /></td>
<td><font color="#FF0000"><span class="required" id="pwdId"></span></font></td>
</tr>
<tr>
<td class="login_info">验证码:</td>
<td class="width70"><input name="VerifyCode" type="text" class="width70" id="VerifyCode"/></td>
<td><img src="./admin/getVerifyCode" alt="验证码" title="点击更换" width="110" height="40" id="verifyCodeImage" /></td>
<td><span class="required" id="VerifyCodemessage" style="display: none">验证码错误</span></td>
</tr>
<tr>
<td></td>
<td class="login_button" colspan="2">
<!-- <a href="index.html"><img src="images/login_btn.png" /></a> -->
<input type="submit" value="登录" />
<a href="service/registe.jsp">注册</a>
</td>
</tr>
</table>
</form>
</div>
</body>在这里插入代码片
后台通过form表单提交到controller层
@RequestMapping("/login")
public String login(String username,String password,HttpSession session,ModelMap map){
User user= userService.login(username, password, session);
if (null != user) {
session.setAttribute("login_info", user);
System.out.println(user.getRole());
List<PrivInfo> privList = privService.getPrivByRole(user.getRole());
map.put("privList",privList);
return "index";
} else {
return "error";
}
}
这里插入代码片