main.js
- JScript code
var addWin function addClick() { if(!addWin) { addWin=new Ext.Window({ title:'tabPanel', width:500, height:400, closable:true, closeAction:'hide', /*listeners:{ 'hide':function(){alert("hide");} //隐藏windows时触发该事件 },*/ items:[tabPanle], buttons:[{ text:'关闭', handler:function(){addWin.hide()} }] }); } addWin.show(this); } var tabPanle=new Ext.TabPanel({ activeTab:0, width:480, height:330, layoutOnTabChange:true, items:[{ title:'tabPanel-Three', autoLoad:{ url:'panel_One.jsp', scripts:true } },{ title:'tabPanel-Three', autoLoad:{ url:'panel_Two.jsp' } }] });
出来现世一个tabpanel面板,上面有两个选项卡,
第一个选项卡的autoLoad到panel_One.jsp页面 就单纯现世一个panel面板
代码:
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ page isELIgnored="true"%>
<%
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 'panel_One.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" href="<%=basePath%>extjs/resources/css/ext-all.css" type="text/css"></link>
<script type="text/javascript" src="<%=basePath%>extjs/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="<%=basePath%>extjs/ext-all.js"></script>
</head>
<script type="text/javascript">
Ext.onReady(function(){
var one_Panel=new Ext.Panel({
renderTo:'rightGridDiv_one',
title:'onePanel',
html:'onePanel的内容'
});
one_Panel.show();
});
</script>
<body>
panel_One<br>
<div id="rightGridDiv_one"></div>
</body>
</html>
第二个选项卡的autoLoad到panel_Two.jsp 就显示一句话:panel_Two
代码
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ page isELIgnored="true"%>
<%
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 'panel_Two.jsp' starting page</title>