最近找到一款不错的标签库ditchnet jsp tabs taglib,什么安装使用,官方网站上都有,我也不多说,
就是这个:
<%@ taglib prefix="tab" uri="http://ditchnet.org/jsp-tabs-taglib" %>
不过很可惜,页面中能点出的标记也就下面这几种...
<tab:tabConfig/>,<tab:tabContainer/>,<tab:tabPane/>,<tab:tabLink/>,<tab:prevTabButton/>,<tab:nextTabButton/>
上面这几种标记也都用过了,也不知道是不是自己才学浅薄,下面是我自己做的一个例子,个人认为它应该
还有居多潜力可挖,自己却不知道怎么来发掘...希望哪位高手路过时不舍赐教....
这是我的Email:lanzhengwu001@163.com
<%
@ page language
=
"
java
"
import
=
"
java.util.*
"
pageEncoding
=
"
gbk
"
%>
< jsp:directive.page import = " java.text.DecimalFormat " />
<% @ taglib prefix = " tab " uri = " http://ditchnet.org/jsp-tabs-taglib " %>
<% @ taglib uri = " /WEB-INF/c.tld " prefix = " c " %>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + " :// " + request.getServerName() + " : " + request.getServerPort() + path + " / " ;
%>
< html >
< head >
< base href = " <%=basePath%> " >
< tab:tabConfig />
< title > My JSP ' tab.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 " >
-->
< script >
function test(temp) ... {
if(temp=='foo-tab')...{
alert("foo");
}else...{
alert("bar");
}
}
</ script >
</ head >
<% int [] temp = ... {22,44,56,77,97} ;
int total = temp[ 0 ] + temp[ 4 ] + temp[ 1 ] + temp[ 2 ] + temp[ 3 ];
DecimalFormat df = new DecimalFormat( " 0.00 " );
double a = Double.parseDouble(df.format((temp[ 0 ] + 0.0 ) / total * 100 ));
double b = Double.parseDouble(df.format((temp[ 1 ] + 0.0 ) / total * 100 ));
double c = Double.parseDouble(df.format((temp[ 2 ] + 0.0 ) / total * 100 ));
double d = Double.parseDouble(df.format((temp[ 3 ] + 0.0 ) / total * 100 ));
double e = Double.parseDouble(df.format((temp[ 4 ] + 0.0 ) / total * 100 ));
ArrayList < Double > list = new ArrayList < Double > ();
list.add(a);list.add(b);list.add(c);list.add(d);list.add(e); %>
< c:set var = " map " value = " <%=list %> " ></ c:set >
< body >
< tab:tabContainer id = " foo-bar-container " selectedTabPaneId = " bar " jsTabListener = " test(this.id) " skin = " wireframe " >
< tab:tabPane id = " foo " tabTitle = " Foo! " >
< table >
< c:forEach var = " per " items = " ${map} " >
< tr >
< td > Foo is cool ! $ ... {per } </ td >
</ tr >
</ c:forEach >
</ table >
</ tab:tabPane >
< tab:tabPane id = " bar " tabTitle = " Bar! " >
< c:out value = " Bar is cooler! " />
</ tab:tabPane >
</ tab:tabContainer >
< tab:tabLink href = " index.jsp " selectedTabPaneId = " foo-bar-container-link " >
This link targets a specific tab on another page.
</ tab:tabLink >
< tab:prevTabButton id = " prev-button " tabContainerId = " my-targeted-tab-container " > PREV </ tab:prevTabButton >
< tab:nextTabButton id = " next-button " tabContainerId = " my-targeted-tab-container " > NEXT </ tab:nextTabButton >
< tab:tabContainer id = " next-prev-container2 " >
< tab:tabPane id = " pane2-1 " tabTitle = " OneOneOneOne " > 1 . Here is tab One. </ tab:tabPane >
< tab:tabPane id = " pane2-2 " tabTitle = " TwoTwoTwoTwo " > 2 . This is tab Two. </ tab:tabPane >
< tab:tabPane id = " pane2-3 " tabTitle = " ThreeThreeThree " > 3 . Finally, tab Three. </ tab:tabPane >
</ tab:tabContainer >
< div >
< tab:prevTabButton tabContainerId = " next-prev-container2 " > PREV </ tab:prevTabButton >
< tab:nextTabButton tabContainerId = " next-prev-container2 " > NEXT </ tab:nextTabButton >
</ div >
</ body >
</ html >
< jsp:directive.page import = " java.text.DecimalFormat " />
<% @ taglib prefix = " tab " uri = " http://ditchnet.org/jsp-tabs-taglib " %>
<% @ taglib uri = " /WEB-INF/c.tld " prefix = " c " %>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + " :// " + request.getServerName() + " : " + request.getServerPort() + path + " / " ;
%>
< html >
< head >
< base href = " <%=basePath%> " >
< tab:tabConfig />
< title > My JSP ' tab.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 " >
-->
< script >
function test(temp) ... {
if(temp=='foo-tab')...{
alert("foo");
}else...{
alert("bar");
}
}
</ script >
</ head >
<% int [] temp = ... {22,44,56,77,97} ;
int total = temp[ 0 ] + temp[ 4 ] + temp[ 1 ] + temp[ 2 ] + temp[ 3 ];
DecimalFormat df = new DecimalFormat( " 0.00 " );
double a = Double.parseDouble(df.format((temp[ 0 ] + 0.0 ) / total * 100 ));
double b = Double.parseDouble(df.format((temp[ 1 ] + 0.0 ) / total * 100 ));
double c = Double.parseDouble(df.format((temp[ 2 ] + 0.0 ) / total * 100 ));
double d = Double.parseDouble(df.format((temp[ 3 ] + 0.0 ) / total * 100 ));
double e = Double.parseDouble(df.format((temp[ 4 ] + 0.0 ) / total * 100 ));
ArrayList < Double > list = new ArrayList < Double > ();
list.add(a);list.add(b);list.add(c);list.add(d);list.add(e); %>
< c:set var = " map " value = " <%=list %> " ></ c:set >
< body >
< tab:tabContainer id = " foo-bar-container " selectedTabPaneId = " bar " jsTabListener = " test(this.id) " skin = " wireframe " >
< tab:tabPane id = " foo " tabTitle = " Foo! " >
< table >
< c:forEach var = " per " items = " ${map} " >
< tr >
< td > Foo is cool ! $ ... {per } </ td >
</ tr >
</ c:forEach >
</ table >
</ tab:tabPane >
< tab:tabPane id = " bar " tabTitle = " Bar! " >
< c:out value = " Bar is cooler! " />
</ tab:tabPane >
</ tab:tabContainer >
< tab:tabLink href = " index.jsp " selectedTabPaneId = " foo-bar-container-link " >
This link targets a specific tab on another page.
</ tab:tabLink >
< tab:prevTabButton id = " prev-button " tabContainerId = " my-targeted-tab-container " > PREV </ tab:prevTabButton >
< tab:nextTabButton id = " next-button " tabContainerId = " my-targeted-tab-container " > NEXT </ tab:nextTabButton >
< tab:tabContainer id = " next-prev-container2 " >
< tab:tabPane id = " pane2-1 " tabTitle = " OneOneOneOne " > 1 . Here is tab One. </ tab:tabPane >
< tab:tabPane id = " pane2-2 " tabTitle = " TwoTwoTwoTwo " > 2 . This is tab Two. </ tab:tabPane >
< tab:tabPane id = " pane2-3 " tabTitle = " ThreeThreeThree " > 3 . Finally, tab Three. </ tab:tabPane >
</ tab:tabContainer >
< div >
< tab:prevTabButton tabContainerId = " next-prev-container2 " > PREV </ tab:prevTabButton >
< tab:nextTabButton tabContainerId = " next-prev-container2 " > NEXT </ tab:nextTabButton >
</ div >
</ body >
</ html >