1. 程式人生 > >關於bootstrap中tab的使用

關於bootstrap中tab的使用



一引入相關檔案

1、bootstrapvoucherinstant.css

2、jquery-2.1.3.min.js

3、bootstrap.js

二、相應的jsp頁面

[html] view plain copy print?
  1. <%@ page language="java"import="java.util.*"pageEncoding="UTF-8"%>
  2. <%  
  3. String path = request.getContextPath();  
  4. String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";  
  5. %>
  6. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  7. <html>
  8.   <head>
  9.     <basehref="<%=basePath%>">
  10.     <title>My JSP 'bootstrap.jsp' starting page</title>
  11.     <metahttp-equiv="pragma"content="no-cache">
  12.     <metahttp-equiv="cache-control"content=
    "no-cache">
  13.     <metahttp-equiv="expires"content="0">
  14.     <metahttp-equiv="keywords"content="keyword1,keyword2,keyword3">
  15.     <metahttp-equiv="description"content="This is my page">
  16.     <linkrel="stylesheet"type="text/css"href="bootstrap/bootstrapvoucherinstant.css"/>
  17.     <script
    type="text/javascript"src="bootstrap/jquery-2.1.3.min.js"></script>
  18.     <scripttype="text/javascript"src="bootstrap/bootstrap.js"></script>
  19.   </head>
  20.   <body>
  21.     <divclass="body_div">
  22.         <divclass="navigation">
  23.             標題部分  
  24.         </div>
  25.         <ulid="myShopTab"class="nav nav-tabs">
  26.             <liclass="active">
  27.                 <ahref="#tab1"data-toggle="tab">群組記錄</a>
  28.             </li>
  29.             <li>
  30.                 <ahref="#tab2"data-toggle="tab">客服記錄</a>
  31.             </li>
  32.         </ul>
  33.         <divid="myTabContent"class="tab-content">
  34.             <divclass="tab-pane fade in active"id="tab1"></div>
  35.             <divclass="tab-pane fade"id="tab2">
  36.                 <iframesrc="index.jsp"frameborder="0"scrolling="no"marginheight="0"marginwidth="0"width="100%"height="450px;"></iframe>
  37.             </div>
  38.         </div>
  39.     </div>
  40.   </body>
  41. </html>
<%@ 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 'bootstrap.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="bootstrap/bootstrapvoucherinstant.css"/>
	<script type="text/javascript" src="bootstrap/jquery-2.1.3.min.js"></script>
	<script type="text/javascript" src="bootstrap/bootstrap.js"></script>
  </head>
  <body>
    <div class="body_div">
    	<div class="navigation">
    		標題部分
    	</div>
    	<ul id="myShopTab" class="nav nav-tabs">
    		<li class="active">
    			<a href="#tab1" data-toggle="tab">群組記錄</a>
    		</li>
    		<li>
    			<a href="#tab2" data-toggle="tab">客服記錄</a>
    		</li>
    	</ul>
    	<div id="myTabContent" class="tab-content">
    		<div class="tab-pane fade in active" id="tab1"></div>
    		<div class="tab-pane fade" id="tab2">
    			<iframe src="index.jsp" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" width="100%" height="450px;"></iframe>
    		</div>
    	</div>
    </div>
  </body>
</html>

 部署好工程在位址列測一下:http://localhost:8080/Mytest/bootstrap.jsp

顯示圖如下: