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

📄 insert_advisor.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 'insert_advisor.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/insert.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>
	<script type="text/javascript" src="ext/source/ext-lang-zh_CN.js"></script>

  </head>
  
<body>

<script type="text/javascript">
Ext.onReady(

function(){
	Ext.QuickTips.init();
	// message target    Ext.form.Field.prototype.msgTarget = "side";
    Ext.form.Field.prototype.msgTarget = 'side'; 
	
	var myForm = new Ext.form.FormPanel({
		//renderTo:"show",//The id of the node, a DOM node or an existing Element that will be the container to render this component into.
		title:"添加学生顾问",//The title text to display in the panel header
		width:425,
		frame:true,//True to render the panel with custom rounded borders, false to render with plain 1px square borders (defaults to false).
		
		//items
		items: [
			//advisorNum
			new Ext.form.TextField({
				id:"advisorNum",//The unique id of this component
				name:'advisorNum',
				fieldLabel:"顾问号",
				width:275,
				allowBlank:false,
				blankText:"Please enter the advisorNum"
				//vtype:"email",
				//vtypeText:"The from field should be an email address in the format of user@domain.com"
			}),
			
			//advisorName
			new Ext.form.TextField({
				id:"advisorName",
				name:'advisorName',
				fieldLabel:"名字",
				width:275,
				allowBlank:false,
				blankText:"Please enter the advisorName"
			}),
			
			//position
			new Ext.form.TextField({
				id:"position",
				name:'position',
				fieldLabel:"职位",
				width:275,
				allowBlank:false,
				blankText:"Please enter the position"
			}),
			
			//department
			new Ext.form.TextField({
				id:"department",
				name:'department',
				fieldLabel:"部门",
	            width:275,
				allowBlank:false,
				blankText:"Please enter the department"
			}),  
			
			//phoneNumber
			new Ext.form.TextField({
	            id:"phoneNumber",
	            name:'phoneNumber',
				fieldLabel:"电话号码",
				width:275,
				allowBlank:false,
				blankText:"Please enter the phoneNumber"
			}),
			
			//roomNum
			new Ext.form.TextField({
	            id:"roomNum",
	            name:'roomNum',
				fieldLabel:"房间号",
				width:275,
				allowBlank:false,
				blankText:"Please enter the roomNum"
			})
		],
		
		//buttons
		buttons: [
        {
			text:"提交",
			type:'submit',
			handler:function(){
				if(myForm.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 < 10; i++){
                        setTimeout(f(i), i*150);
                    }
					//提交到服务器操作
	                myForm.form.doAction(
						'submit',				
						{
							url:'<%=basePath%>insertAdvisor2.do',//servlet文件路径
							method:'post',//提交方法post或get
							params:'',
							
							//提交成功的回调函数
							success:function(form,action){
								if (action.result.msg=='success') {
									Ext.Msg.alert('操作成功',action.result.msg);
								}                                  
								else{
									Ext.Msg.alert('抱歉操作失败',action.result.msg);
								}
							},
							
							//提交失败的回调函数
							failure:function(){
								Ext.Msg.alert('错误','服务器出现错误请稍后再试!');
							}
                        }
					);	
				}
			}
		},
		
        {
			text:"重置",
			handler:function(){myForm.form.reset();}//重置表单
		}
		]	
	});
   
   
    win = new Ext.Window({
        id:'win',
        title:'添加学生顾问',
        layout:'fit',   //之前提到的布局方式fit,自适应布局               
        width:450,
        height:350,
        plain:true,
        bodyStyle:'padding:5px;',
        maximizable:false,//禁止最大化
        closeAction:'close',
        closable:false,//禁止关闭
        collapsible:true,//可折叠
        plain: true,
        buttonAlign:'center',
        items:myForm//将表单作为窗体元素嵌套布局
    });
	// myForm.render(document.body);
	win.show(document.body);	
});
</script>

<div id="container">
	
</div>
</body>
</html>

⌨️ 快捷键说明

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