login.jsp

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="java.net.URLEncoder"%>
<%@page import="java.net.URLDecoder"%>
<%@page import="java.io.UnsupportedEncodingException"%>
<%
//项目相对及绝对路径
String contextPath = request.getContextPath();
String absPath = this.getServletContext().getRealPath("");
%>

<%
Cookie cookies[]=request.getCookies();
Cookie sCookie=null;
String nextLanguageAlias = "中文版";
if(cookies!=null){
for(int i=0;i<cookies.length;i++){
sCookie=cookies[i];
if(sCookie!=null){
if(sCookie.getName().equals("power7000NextLanguageAlias")){
nextLanguageAlias = URLDecoder.decode(sCookie.getValue(),"UTF-8");
break;
}
}
}
}
%>

<script type='text/javascript' src='<%=contextPath%>/dwr/engine.js'></script>
<script type='text/javascript' src='<%=contextPath%>/dwr/util.js'></script>
<script type='text/javascript' src='<%=contextPath%>/dwr/interface/dwrLoginService.js'></script>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>登录页面</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta content="width=device-width, initial-scale=1.0" name="viewport"/>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<meta content="" name="description"/>
<meta content="" name="author"/>
<!-- BEGIN GLOBAL MANDATORY STYLES -->
<link href="http://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700&subset=all" rel="stylesheet" type="text/css"/>
<link href="<%=contextPath%>/js/plugi/global/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css"/>
<link href="<%=contextPath%>/js/plugi/global/plugins/simple-line-icons/simple-line-icons.min.css" rel="stylesheet" type="text/css"/>
<link href="<%=contextPath%>/js/plugi/global/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
<link href="<%=contextPath%>/js/plugi/global/plugins/uniform/css/uniform.default.css" rel="stylesheet" type="text/css"/>
<!-- END GLOBAL MANDATORY STYLES -->
<!-- BEGIN PAGE LEVEL STYLES -->
<link href="<%=contextPath%>/js/plugi/global/plugins/select2/select2.css" rel="stylesheet" type="text/css"/>
<link href="<%=contextPath%>/js/plugi/admin/pages/css/login-soft.css" rel="stylesheet" type="text/css"/>
<!-- END PAGE LEVEL SCRIPTS -->
<!-- BEGIN THEME STYLES -->
<link href="<%=contextPath%>/js/plugi/global/css/components.css" id="style_components" rel="stylesheet" type="text/css"/>
<link href="<%=contextPath%>/js/plugi/global/css/plugins.css" rel="stylesheet" type="text/css"/>
<link href="<%=contextPath%>/js/plugi/admin/layout/css/layout.css" rel="stylesheet" type="text/css"/>
<link id="style_color" href="<%=contextPath%>/js/plugi/admin/layout/css/themes/darkblue.css" rel="stylesheet" type="text/css"/>
<link href="<%=contextPath%>/js/plugi/admin/layout/css/custom.css" rel="stylesheet" type="text/css"/>
<!-- END THEME STYLES -->
<link rel="shortcut icon" href="favicon.ico"/>
</head>

<body class="login" onload="resize('center');">
<!-- BEGIN LOGO -->
<div class="logo">

<h2><span></span></h2>
<img src="<%=contextPath%>/assets/admin/layout/img/logo-invert.png" style="height: 30px;100px;" alt=""/>

</div>
<!-- END LOGO -->
<!-- BEGIN LOGIN -->

<div style="99%; align:center;">
<div class="content" id="center" style="display:block; 360px;" >

<!-- nextLanguageAlias:切换语言 -->
<a href="javascript:void(0);" style="color:red" onclick="changeLanguage();location.reload();" class="tit"><%=nextLanguageAlias%></a>&nbsp;&nbsp;|&nbsp;&nbsp;
>
<!-- BEGIN LOGIN FORM -->
<form action="checkLogin.do" class="login-form" method="post" id="OIform" onSubmit="return false;">
<input type="text" name="notautosubmit" style="display:none"/>
<h3 class="form-title" data-i18n="system.login.HeadLabel"></h3>
<div class="alert alert-danger display-hide">
<button class="close" data-close="alert"></button>
<span data-i18n="login.LoginTipInfo"></span>
</div>
<div class="form-group">
<label class="col-md-5 control-label bold" data-i18n="system.login.UserName"></label>
<div class="col-md-7">
<input class="form-control input-inline input-middle" type="text" id="txt_usr_name" autocomplete="off" placeholder="用户帐号" name="operatorName"
style="position:relative; left:-27px;"/>
</div>
</div><br><br>
<div class="form-group" style="margin-top:8px;">
<label class="col-md-5 control-label bold" data-i18n="system.login.UserPassword"></label>
<div class="col-md-7">
<input class="form-control input-inline input-middle" type="password" id="password" autocomplete="off" placeholder="帐号密码" name="loginPwd"
style="position:relative; left:-27px;"/>
</div>
</div>

</form>
<div class="form-actions">
<label class="checkbox" style="position:relative;left:20px;">
<input type="checkbox" name="remember" value="1"/> <span data-i18n="system.login.SavePwd">记住密码</span> </label>
<button class="btn blue pull-right col-md-3" style="margin-top:30px; " id="btnLogin" onclick="check();"
data-i18n="system.login.Login">
登录
</button>

<button type="reset" class="btn blue pull-right col-md-3" style="margin-top:30px; position:relative; left:-20px;" id="btnReset" onclick="reset();" data-i18n="system.login.Reset">
重置
</button>
</div>

<span style="font-family:微软雅黑,宋体;font-size:1em;color:#f00;display:none" id="showMessage" data-i18n="system.login.ErrorMsg">用户名或密码错误</span>
<div class="forget-password">
<h4 data-i18n="system.login.ForgetPwd"></h4>
<p>
<span data-i18n="system.login.FindPwd1">不用担心, 点击</span> <a href="javascript:;" id="forget-password" data-i18n="system.login.FindPwd2">
这里 </a>
<span data-i18n="system.login.FindPwd3">找回密码.</span>
</p>
</div>
<div class="create-account">
<p>
<span data-i18n="system.login.Regist1"> 还没有帐号 ?</span>&nbsp; <a href="javascript:;" id="register-btn" data-i18n="system.login.Regist2">
注册帐号 </a>
</p>
</div>
<!-- END LOGIN FORM -->
</div>
</div>


<!-- END LOGIN -->
<!-- BEGIN COPYRIGHT -->
<div class="copyright">
2015 &copy; Power7000 Prepayment & AMI System Ver1.0.0.0.
</div>
<!-- END COPYRIGHT -->
<!-- BEGIN JAVASCRIPTS(Load javascripts at bottom, this will reduce page load time) -->
<!-- BEGIN CORE PLUGINS -->
<!--[if lt IE 9]>
<script src="../../assets/global/plugins/respond.min.js"></script>
<script src="../../assets/global/plugins/excanvas.min.js"></script>
<![endif]-->
<script src="<%=contextPath%>/js/jqGrid/js/jquery-1.11.1.js" type="text/javascript"></script>
<script src="<%=contextPath%>/js/plugi/global/plugins/jquery-migrate.min.js" type="text/javascript"></script>
<script src="<%=contextPath%>/js/plugi/global/plugins/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script src="<%=contextPath%>/js/plugi/global/plugins/jquery.blockui.min.js" type="text/javascript"></script>
<script src="<%=contextPath%>/js/plugi/global/plugins/uniform/jquery.uniform.min.js" type="text/javascript"></script>
<script src="<%=contextPath%>/js/plugi/global/plugins/jquery.cokie.min.js" type="text/javascript"></script>
<!-- END CORE PLUGINS -->
<!-- BEGIN PAGE LEVEL PLUGINS -->
<script src="<%=contextPath%>/js/plugi/global/plugins/jquery-validation/js/jquery.validate.min.js" type="text/javascript"></script>
<script src="<%=contextPath%>/js/plugi/global/plugins/backstretch/jquery.backstretch.min.js" type="text/javascript"></script>
<script type="text/javascript" src="../../assets/global/plugins/select2/select2.min.js"></script>
<!-- END PAGE LEVEL PLUGINS -->
<!-- BEGIN PAGE LEVEL SCRIPTS -->
<script src="<%=contextPath%>/js/plugi/global/scripts/metronic.js" type="text/javascript"></script>
<script src="<%=contextPath%>/js/plugi/admin/layout/scripts/layout.js" type="text/javascript"></script>
<script src="<%=contextPath%>/js/plugi/admin/layout/scripts/demo.js" type="text/javascript"></script>
<script src="<%=contextPath%>/js/plugi/admin/pages/scripts/login-soft.js" type="text/javascript"></script>
<!-- END PAGE LEVEL SCRIPTS -->

<script type='text/javascript' src='<%=contextPath%>/js/cookie.js'></script>
<script type='text/javascript' src='<%=contextPath%>/js/i18next.min.js'></script>
<script type='text/javascript' src='<%=contextPath%>/js/translation.js'></script>

<script>

jQuery(document).ready(function() {
$.backstretch([
"<%=contextPath%>/js/plugi/admin/pages/media/bg/1.jpg",
"<%=contextPath%>/js/plugi/admin/pages/media/bg/2.jpg",
"<%=contextPath%>/js/plugi/admin/pages/media/bg/3.jpg",
"<%=contextPath%>/js/plugi/admin/pages/media/bg/4.jpg"
], {
fade: 1000,
duration: 8000
}
);



//添加数据 打开新窗口
function LoginPage(){
var windowUrl = "<%=contextPath%>/ami/orgnization/add/"+ pk + ".do";
//window.open (windowUrl, "newwindow", "height=400, width=400, toolbar= no, menubar=no, scrollbars=no, resizable=no, location=no, status=no");
}
</script>
<script type="text/javascript">
$(document).ready(function(){
$(document).keydown(function(event){
if(event.keyCode==13){
$("#btnLogin").click();
}
});
});

function check_login(){
alert("111");
window.location.href ="<%=contextPath%>/security/mantain/showHomePage.do";
}

function check(){
$.post("checkLogin.do",$("#OIform").serialize(),function(date){
if(date==0){
$("#showMessage").show();
}else{
location.href="<%=contextPath%>/security/mantain/showHomePage.do";
}
});
}
function reset(){
$("#showMessage").hide();
$("#txt_usr_name").val("");
$("#password").val("");
}

</script>
<!-- END JAVASCRIPTS -->
</body>
</html>

原文地址:https://www.cnblogs.com/zhu-java/p/4564744.html