ExtremeTable的简单配置

来源:互联网 发布:java string trim函数 编辑:程序博客网 时间:2024/05/07 06:04
有个朋友问我ExtremeTable如何使用,我合计着写一个给其他新手看看入门也挺有价值的,就算是普度众生了
1.要想使用ExtremeTable首先得去[url=http://www.extremecomponents.org/extremesite/index.jsp]http://www.extremecomponents.org/extremesite/index.jsp[/url]
[color=#154ba0]串[/color]串门,把他的文件下载下来。文件名为:eXtremeComponents-1.0.1-with-dependencies.zip

2.在Eclipse中创建一个web project,在webroot下添加css,images两个文件夹。这两个文件夹分别是用来存放ExtremeTable的style和图片的。有的人可能会问,style和image从何而来?别急,就在我们刚才下的包里面。解压缩,里面有5个文件夹,分别是dist,images,lib,source,test。直接把images里面的内容考到我们刚才在webroot下建的images下,再把dist/extremecomponents.css拷贝到css目录下。

3.接着在/webroot/WEB-INF/下创建两个文件夹,分别为lib,tld。从解压缩后的目录/lib/minimum复制全部.jar和dist/extremecomponents-1.0.1.jar文件到新创建的lib目录中,复制dist/extremecomponents.tld到新创建的tld目录中。

这样基本配置工作就完成了,下面要稍微写一些代码。

4.在webroot下添加test.jsp,代码为
<%@ taglib prefix="ec" uri="/WEB-INF/tld/extremecomponents.tld" %>
<%@ taglib prefix="c" uri="[url=http://java.sun.com/jstl/core]http://java.sun.com/jstl/core[/url]" %>
<%@ page c%>
<html>
<head>
  <title>eXtremeTest</title>
  <link rel="stylesheet" type="text/css" href="<c:url value="/css/main.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 style="margin:25px;">
<p style="font-family: Verdana;font-size:14px;">
  Congratulations!! You have successfully configured eXtremeTable!
</p>
<br>
<ec:table
  items="pres"
  action="${pageContext.request.contextPath}/test.jsp"
  imagePath="${pageContext.request.contextPath}/images/table/*.gif"
  title="Presidents"
  width="60%"
  rowsDisplayed="5"
  >
  <ec:row>
   <ec:column property="name"/>
   <ec:column property="nickname"/>
   <ec:column property="term"/>
  </ec:row>
</ec:table>
<br>
</body>
</html>

这样ExtremeTable就配置好了,看看标签的属性就知道对应的功能了,没有什么难的,其余的功能大家自己扩展吧
 
原创粉丝点击