<html>
<head>
<title>供应商服务系统 V1.0</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="js/ext/resources/css/ext-all.css" />
<script type="text/javascript" src="js/ext/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="js/ext/ext-all.js"></script>
<script type="text/javascript" src="js/ext/build/locale/ext-lang-zh_CN.js"></script>
<script type="text/javascript" src="js/logon.js"></script>
</head>
<body>
</body>
</html>
Ext.onReady(function(){
Ext.QuickTips.init();
Ext.form.Field.prototype.msgTarget = 'side';
var login = new Ext.FormPanel({
labelWidth:70,
labelAlign :'right',
frame:true,
defaults: {width: 170},
bodyStyle:'padding:10px 5px 0',
defaultType:'textfield',
monitorValid:true,
items:[{
fieldLabel:'用户帐号',
name:'userId',
emptyText:'请输入用户帐号',
allowBlank:false
},{
fieldLabel:'用户密码',
name:'password',
inputType:'password',
allowBlank:false
}],
buttons:[{
text:'登录',
formBind: true,
// Function that fires when user clicks the button
handler:function(){
login.getForm().submit({
method:'POST',
waitTitle:'系统提示',
waitMsg:'正在登录,请稍候...',
url:'Logon.do',
// Functions that fire (success or failure) when the server responds.
// The one that executes is determined by the
// response that comes from Logon.do as seen below. The server would
// actually respond with valid JSON,
// something like: response.write "{ success: true}" or
// response.write "{ success: false, errors: { reason: 'Login failed. Try again.' }}"
success:function(){
var redirect = 'index.html';
window.location = redirect;
},
// Failure function, see comment above re: success and failure.
// You can see here, if login fails, it throws a messagebox
// at the user telling him / her as much.
failure:function(form, action){
if(action.failureType == 'server'){
obj = Ext.util.JSON.decode(action.response.responseText);
Ext.Msg.alert('登录失败', obj.errors.reason,function() {form.findField('userId').focus();});
}else{
Ext.Msg.alert('Warning!', 'Authentication server is unreachable : ' + action.response.responseText);
}
}
});
}
}]
});
// This just creates a window to wrap the login form.
// The login object is passed to the items collection.
var win = new Ext.Window({
title:'用户登录',
layout:'fit',
border:false,
width:300,
//height:160,
closable: false,
resizable: false,
plain: true,
items: [login]
});
win.show();
});
package com.linbq.servlet;
import java.util.*;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import com.linbq.bean.*;
/** *//**
* 用户登录操作响应控制
* <p>对用户登录等响应请求进行处理.</p>
* @author linbq
*/
public class LogonServlet extends HttpServlet
{
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
String userId = request.getParameter("userId");
String password = request.getParameter("password");
//安全性检查,防止非法操作Servlet
if (userId == null || userId.length() == 0 || password == null || password.length() == 0) return;
response.setContentType("text/xml;charset=UTF-8");
response.setHeader("Cache-Control", "no-cache");
PrintWriter out=response.getWriter();
User user = new User();
if (user.logon(userId, password)) {
HttpSession session = request.getSession();
session.setAttribute("userId", user.getId());
session.setAttribute("userName", user.getName());
out.write("{ success: true}");
} else {
out.write("{ success: false, errors: { reason: '用户帐号或密码验证不通过.' }}");
}
out.close();
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
doGet(request, response);
}
}
分享到:
相关推荐
无忧登录51logon无忧登录51logon无忧登录51logon
西门子SIMATIC Logon的手册pdf,西门子SIMATIC Logon的手册
西门子SIMATIC Logon的使用入门pdf,西门子SIMATIC Logon的使用入门:本文主要介绍SIMATIC登录软件的功能,以及SIMATIC登录在SIMATIC PCS 7系统中的应用。
sap 的Logon的几个参数,Password Checks,Multiple Logon,Incorrect Logon,SSO Logon Ticket
fix协议实现 logon消息 heart beat消息 ,验证了test request。
W10 BG Logon Changer win10登录页面背景修改
saplogon软件
一款很实用的小工具Logon Editor 绿色汉化版,可以快速修改WIN7系统的登陆背景图片,如果你厌倦了WIN7的经典登陆背景,可以修改成自己喜欢的。软件已经汉化并做成单文件版,使用起来更方便。可以修改文本和按钮...
Customer_Remote_Logon_Depot_Help.pdf
java_struts demo
SAP GUI Logon登陆条目为灰色,无法编辑的解决方法.
通过修改文件和注册表!实现修改登陆界面背影!
logon3.asp
Logon Screen 3.01 中文版是一款非常简单易用的 Windows 登录屏幕壁纸更改工具。当我们看腻了 Windows 自带的登录界面,我们就可以使用 Logon Screen 轻易 DIY 你的电脑登录界面了。 Windows 登录背景更换工具 ...
Logon Loader 2.1.0登陆界面 修改登陆界面!
2000个动态Logon的GIF模板
自学SAP ERP必备安装包虚拟机
Logon Loader(登录界面更换器)
W10 BG Logon Changer 1.2.0.0 win10桌面背景修改 支持中文
logon.py