EXT 인스턴스

4790 단어 ext

(1) 버튼 추가
 
JSP:
 
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
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 '004_base02_ext.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="js/extjs/resources/css/ext-all.css" />
	<script type="text/javascript" charset="utf-8" src="js/extjs/ext-all-debug.js"></script>
	<script type="text/javascript" charset="utf-8" src="js/extjs/ext-lang-zh_CN.js"></script>
	<script type="text/javascript" charset="utf-8" src="base/test.js"></script>

  </head>
  
  <body>
  <div id="button"></div>
  </body>
</html>

 
JS:
 
Ext.onReady(function(){
	var button = new Ext.Button({  
        text:" ",  
        pressed:true,  
        height:30,  
        renderTo:"button",  
        handler:hello 
    });  
});

function hello(){  
    alert('hello,world');  
} 

 
 
(2) 일반적인 사용자 로그인 인터페이스
 
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title> </title>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/resources/css/ext-all-debug.css">
<script type="text/javascript" src="${pageContext.request.contextPath}/js/ext-all-debug.js"></script>
<script type="text/javascript">
Ext.onReady(function(){
	Ext.widget('form', {
        renderTo: Ext.getBody(),
        frame: true,
        width: 350,
        items: [{
            xtype: 'textfield',
            name: 'username',
            fieldLabel: ' ',
            allowBlank: false,
            minLength: 6
        },{
            xtype: 'textfield',
            name: 'password',
            fieldLabel: ' ',
            allowBlank: false,
            minLength: 6
        }],
        dockedItems: [{
            xtype: 'container',
            dock: 'bottom',
            layout: {
                type: 'hbox',
                align: 'middle'
            },
            padding: '10 10 5',
            items: [{
            	xtype: 'button',
                text: ' ',
                width: 140,
                handler: function() {
                    var form = this.up('form').getForm();
                    form.submit({
                        clientValidation: true,
                        url: 'login.do',
                        success: function(form, action) {
                           alert(" !!");
                        },
                        failure: function(form, action) {
                            alert(" !!!");
                        }
                    });
                    
                }
            }]
        }]
	});
});
</script>
</head>
<body>

</body>
</html>

좋은 웹페이지 즐겨찾기