此練習為建立一個則有東、西、南、北、中之border layout。
且東邊及西邊皆具有開合功能。中間內放個Tab Panel,有三個Tab可選擇,預設打開第一個Tab,
Tab索引是從零開始。
開發環境:
IDE:MyEclipse6.6GA
Web Server:Tomcat 6.0.20
Database:MySql 5.1.36
MVC:Struts2.1.8
FrameWork:Spring2.0,Hibernate3.2
Client UI:Ext2.3.0
一、Layout頁面(layout1.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 'combox.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="styles.css"> --> <link rel="stylesheet" type="text/css" href="extjs/resources/css/ext-all.css"> <link rel="stylesheet" type="text/css" href="css/onReady.css"> <script type="text/javascript" src="extjs/adapter/ext/ext-base.js"></script> <script type="text/javascript" src="extjs/ext-all.js"></script> <script type="text/javascript" src="extjs/ext-lang-zh_TW.js"></script> <script type="text/javascript"> <!-- Ext.onReady(function(){ Ext.BLANK_IMAGE_URL='extjs/resources/images/default/s.gif'; var viewport = new Ext.Viewport({ layout: 'border', renderTo: Ext.getBody(), items: [{region: 'north', xtype: 'panel', html: 'North'}, {region: 'west', xtype: 'panel', split: true, //open/close panel collapsible: true, collapseMode: 'mini', title: 'Some Info', bodyStyle:'padding:5px;', width: 200, minSize: 200, html: 'West'}, {region: 'center', //Adding a tab panel xtype: 'tabpanel', activeTab: 0, items: [{ title: 'Movie Grid', html: 'Center'}, {title: 'Movie Descriptions', html: 'Movie Info'}, {title: 'Movie Grid2', html:'Center2'}] }, {region: 'east', xtype: 'panel', split: true, title: 'genre information form', //open/close panel collapsible: true, width: 200, html: 'East' }, {region: 'south', xtype: 'panel', html: 'South'}] }); }); //--> </script> </head> <body> </body> </html>
二、測試結果:
1.http://localhost:8080/ExtStudy/Basic/layout1.jsp
沒有留言:
張貼留言