⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 login2.jsp

📁 数据库系统教材中附录的课程设计accomodation宿舍管理系统源码
💻 JSP
字号:
<%@ page language="java" import="java.util.*" pageEncoding="gb2312"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'login2.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	
	<link rel="stylesheet" type="text/css" href="<%=basePath%>styles/login.css"/>
	<link rel="stylesheet" type="text/css" href="ext/resources/css/ext-all.css" /> 
<script type="text/javascript" src="ext/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="ext/ext-all.js"></script>

  </head>
  
  <body>
<script>
Ext.onReady(function(){   
          //使用表单提示
          Ext.QuickTips.init();
          Ext.form.Field.prototype.msgTarget = 'side';
        
        //定义表单
          var simple = new Ext.FormPanel({
            labelWidth: 75,          
            baseCls: 'x-plain',
            defaults: {width: 150},
            defaultType: 'textfield',//默认字段类型
                 
            //定义表单元素
            items: [{
                  fieldLabel: '帐户',
                  name: 'staffId',//元素名称
                  //anchor:'95%',//也可用此定义自适应宽度
                  allowBlank:false,//不允许为空
                  blankText:'帐户不能为空'//错误提示内容
               },{
                   inputType:'password',
                  fieldLabel: '密码',
                  //anchor:'95%',
                  name: 'password',
                  allowBlank:false,
                  blankText:'密码不能为空'
               }
            ],

            buttons: [{
               text: '登陆',
               type: 'submit',
               //定义表单提交事件
               handler:function(){
                              if(simple.form.isValid()){//验证合法后使用加载进度条
                           Ext.MessageBox.show({
                              title: '请稍等',
                              msg: '正在加载...',
                              progressText: '',
                              width:300,
                              progress:true,
                              closable:false,
                              animEl: 'loding'
                           });
                           //控制进度速度
                           var f = function(v){
                            return function(){
                                    var i = v/11;
                                    Ext.MessageBox.updateProgress(i, '');
                                    };
                           };

                           for(var i = 1; i < 13; i++){
                              setTimeout(f(i), i*150);
                           }
                                  
                          //提交到服务器操作
                          simple.form.doAction('submit',{
                            url:'<%=basePath%>login2.do',//文件路径
                            method:'post',//提交方法post或get
                            params:'',
                            //提交成功的回调函数
                            success:function(form,action){
                                 if (action.result.auth=='auth_manager') {
                                    document.location='<%=basePath%>pages/manager.jsp';
                                 } 
                                 else if(action.result.auth=='auth_director'){
                                 	document.location='<%=basePath%>pages/director.jsp';
                                 }
                                 else if(action.result.auth=='auth_assistant'){
                                 	document.location='<%=basePath%>pages/assistant.jsp';
                                 }             
                                 else{
                                    Ext.Msg.alert('登陆错误',action.result.msg);
                                 }
                            },
                            //提交失败的回调函数
                            failure:function(){
                                 Ext.Msg.alert('错误','服务器出现错误请稍后再试!');
                            }
                          });
                        }                                                    
               }
            },{
               text: '取消',
               handler:function(){simple.form.reset();}//重置表单
            }]
         });    
                //定义窗体
               win = new Ext.Window({
                  id:'win',
                  title:'用户登陆',
                  layout:'fit',   //之前提到的布局方式fit,自适应布局               
                  width:300,
                  height:150,
                  plain:true,
                  bodyStyle:'padding:5px;',
                  maximizable:false,//禁止最大化
                  closeAction:'close',
                  closable:false,//禁止关闭
                  collapsible:true,//可折叠
                  plain: true,
                  buttonAlign:'center',
                  items:simple//将表单作为窗体元素嵌套布局
               });
               win.show("formBody");//显示窗体                   
       });
</script>
<div id="container">
	<div id="mainBody">
		<form id="formBody">
			<h1>公寓管理系统</h1>
		</form>
	</div>
</div>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -