ページングコンポーネントextremeComponentsの使用


1.からhttp://www.extremecomponents.org関連ファイルのダウンロード
関連するJarパッケージ、css、tldファイルを含む
2.extremecomponents-1.0.1.JArをweb-inf/libの下に置く
3.ダウンロードしたimagesフォルダをWebRootディレクトリの下に置く
4.ダウンロードするextremecomponents.cssはWebRootディレクトリの下にあるcssフォルダの下に置く
5.extremecomponentsのテストページを新規作成ExtremeComponentTest_1.jsp:

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://www.extremecomponents.org" prefix="ec" %>
<%
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 'ExtremeCompomentTest_1.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="<%=path%>/css/extremecomponents.css">

  </head>
  
  
  <%
    java.util.List presidents = new java.util.ArrayList();

    java.util.Map president = new java.util.HashMap();
	president.put("name", "George Washington");
	 president.put("nickname", "Father of His Country"); 
	 president.put("term", "1789-1797");
	 presidents.add(president);
	
	 president = new java.util.HashMap(); 
	 president.put("name", "John Adams"); 
	 president.put("nickname", "Atlas of Independence");
	 president.put("term", "1797-1801"); 
	 presidents.add(president); 
	
	 president = new java.util.HashMap(); 
	 president.put("name", "Thomas Jefferson");
	  president.put("nickname", "Man of the People, Sage of Monticello");
	 president.put("term", "1801-09");
	 presidents.add(president); 
	
	 president = new java.util.HashMap(); 
	 president.put("name", "James Madison"); 
	  president.put("nickname", "Father of the Constitution"); 
	 president.put("term", "1809-17"); 
	 presidents.add(president); 
	
	 president = new java.util.HashMap(); 
	  president.put("name", "James Monroe"); 
	 president.put("nickname", "The Last Cocked Hat, Era-of-Good-Feelings President"); 
	 president.put("term", "1817-25"); 
	 presidents.add(president); 
	
	 president = new java.util.HashMap(); 
	 president.put("name", "John Adams"); 
	 president.put("nickname", "Old Man Eloquent"); 
	 president.put("term", "1825-29"); 
	 presidents.add(president); 
	
	 request.setAttribute("pres", presidents); %>
  
  <body>
    This is my JSP page. <br>
    <ec:table items="pres" 
              title="ExtremeCompomentTest"
              action="${pageContext.request.contextPath}/ExtremeCompomentTest_1.jsp"
              imagePath="${pageContext.request.contextPath}/images/table/*.gif"
              rowsDisplayed="2"
              >
        <ec:row>
            <ec:column property="name"></ec:column>
            <ec:column property="nickname"></ec:column>
            <ec:column property="term"></ec:column>
        </ec:row>
    </ec:table>
  </body>
</html>

6.ページを実行する効果は次のとおりです.
分页组件extremeComponents的使用_第1张图片
7.テストのJspページ-ExtremComponentTest_1.jspによる分析:
1)ページに<%@taglib uri="を追加するhttp://www.extremecomponents.org"prefix="ec"%>
2)ページにのCss構成情報を追加
3)HashMapを作成し、requestにpresidentsを配置する
  

    <%
    java.util.List presidents = new java.util.ArrayList();

    java.util.Map president = new java.util.HashMap();
	president.put("name", "George Washington");
	 president.put("nickname", "Father of His Country"); 
	 president.put("term", "1789-1797");
	 presidents.add(president);
	
	 president = new java.util.HashMap(); 
	 president.put("name", "John Adams"); 
	 president.put("nickname", "Atlas of Independence");
	 president.put("term", "1797-1801"); 
	 presidents.add(president); 
	
	 president = new java.util.HashMap(); 
	 president.put("name", "Thomas Jefferson");
	  president.put("nickname", "Man of the People, Sage of Monticello");
	 president.put("term", "1801-09");
	 presidents.add(president); 
	
	 president = new java.util.HashMap(); 
	 president.put("name", "James Madison"); 
	  president.put("nickname", "Father of the Constitution"); 
	 president.put("term", "1809-17"); 
	 presidents.add(president); 
	
	 president = new java.util.HashMap(); 
	  president.put("name", "James Monroe"); 
	 president.put("nickname", "The Last Cocked Hat, Era-of-Good-Feelings President"); 
	 president.put("term", "1817-25"); 
	 presidents.add(president); 
	
	 president = new java.util.HashMap(); 
	 president.put("name", "John Adams"); 
	 president.put("nickname", "Old Man Eloquent"); 
	 president.put("term", "1825-29"); 
	 presidents.add(president); 
	
	 request.setAttribute("pres", presidents); %>
   

4)bodyのデータについて
  

    <ec:table items="pres" 
              title="ExtremeCompomentTest"
              action="${pageContext.request.contextPath}/ExtremeCompomentTest_1.jsp"
              imagePath="${pageContext.request.contextPath}/images/table/*.gif"
              rowsDisplayed="2"
              >
        <ec:row>
            <ec:column property="name"></ec:column>
            <ec:column property="nickname"></ec:column>
            <ec:column property="term"></ec:column>
        </ec:row>
    </ec:table>
   

このうちitems="pres"はデータソース、title="ExtremeComponentTest"はtableのヘッダ情報、imagePathはピクチャのパス、rowsDisplayedは各ページに表示されるレコード数、actionは次のページをクリックして、前のページをジャンプするページです.
参照ドキュメント:
http://blogold.chinaunix.net/u/7893/showart_426623.html