- 浏览: 782171 次
- 性别:
- 来自: 北京
文章分类
- 全部博客 (386)
- Linux (36)
- Tomcat (6)
- windows (8)
- Apache (10)
- Java (25)
- jquery (7)
- Jquery 插件 (3)
- Oracle (5)
- Oracle SQL (68)
- Spring (15)
- 开发工具 (6)
- Struts (20)
- js (14)
- Project Code (2)
- Project Code Tomcat (1)
- libset (1)
- JSP (8)
- arithmetic (2)
- 浏览器 (1)
- extjs (3)
- 学习网站 (5)
- 生活情感 (0)
- 电话号码算法 (3)
- 快捷键 (1)
- 转载 (1)
- Dos命令 (2)
- services (1)
- Resources (1)
- 行业积累 (3)
- 项目积累 (3)
- Web (3)
- 文档 (1)
- JavaEE (2)
- JSF (3)
- http (3)
- JS窗口 (1)
- Html (4)
- Flex (1)
- 资讯 (2)
- 项目规范 (1)
- Struts s:property textarea中默认值用 (1)
- Quartz 2.0.2 (12)
- 1天有多少毫秒 (1)
- 专题 (1)
- intellij idea 10 CD-KEY (1)
- restlet (4)
- Mail (1)
- Excel (3)
- Menu (1)
- Big Data技术综述 (1)
- Quart 1 (1)
- nosql (1)
- linux远程 (1)
- jdk (5)
- wind7 (1)
- 虚拟人 (0)
- 虚拟机 (1)
- 终端 (1)
- Ubuntu (16)
- Myeclipse (2)
- Wmware (1)
- eclipse (2)
- css (2)
- csv (1)
- 开源 (1)
- plsql (2)
- cassandra (4)
- maven (1)
- hadoop (2)
- mysql (1)
- spring security (1)
- tools (1)
- jdbc (2)
- exception (2)
- 硬盘数据备份 (1)
- dwr (1)
- svn (1)
- PowerDesigner15使用时的十五个问题 (1)
- tomcat 项目发部路径 (1)
- js 暂停执行 (1)
- jquery jqgrid 格式化数据显示 (1)
- js 代码模板 (1)
- strutss2 直接跳转到jsp页面 (1)
- servlet (1)
- jdbc spring (1)
- js学习网站 (1)
- 自学考试 (2)
- hibernate (2)
- eos (1)
- c (4)
- 黑马 (2)
- 大数据 (2)
- 实战云大数据案例分享 (0)
- Spark (2)
- Flink (1)
最新评论
-
coosummer:
推荐使用http://buttoncssgenerator.c ...
jquery button 漂亮 -
thinktothings:
Array_06 写道你好,我是一名刚毕业学生,我以后就是做J ...
如何转型架构师 -
thinktothings:
软考,考有职业资格证,有系统的知识体系学习
如何转型架构师 -
Array_06:
你好,我是一名刚毕业学生,我以后就是做Java的架构师,那请问 ...
如何转型架构师 -
beykery:
你这也太复杂了。。。。jsf2不应该是这样的。。。。
JSF2.0的一个简单Demo
display table外部分页,支持外部排序
操作步骤:
第一部:
web.xml
<!--引入标签--> <jsp-config> <taglib> <taglib-uri>http://jsptags.com/tags/navigation/pager</taglib-uri> <taglib-location>/WEB-INF/displaytag-11.tld</taglib-location> </taglib> </jsp-config> <!--配置,分页后台业务处理servlet--> <servlet-mapping> <servlet-name>CustomerServlet</servlet-name> <url-pattern>/servlet/CustomerServlet</url-pattern> </servlet-mapping> <!--欢迎页面--> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list>
欢迎页面 index.jsp
<%@ 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 'index.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"> </head> <body> <h1><a href="<%=request.getContextPath()%>/servlet/CustomerServlet"><%=request.getContextPath()%>/servlet/CustomerServlet</a></h1> </body> </html>
result.jsp
result.jsp <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <%@ taglib prefix="display" uri="http://displaytag.sf.net" %> <% 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 'index.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" href="<%=request.getContextPath()%>/css/print.css" type="text/css" media="print" /> <link rel="stylesheet" href="<%=request.getContextPath()%>/css/screen.css" type="text/css" media="screen,print" /> </head> <body> <display:table name="list" class="its" id="item" name="list" sort="external" pagesize="${pageSize}" partialList="true" size="resultSize" requestURI="/displaypagination/servlet/CustomerServlet"> <display:column property="id" title="I" ></display:column> <display:column property="numcuguid" title="ID" sortable="true" ></display:column> <display:column property="vc2cuname" title="vc2cuname" sortable="true"></display:column> <display:column property="vc2cucode" title="vc2cucode" sortable="true"></display:column> </display:table> </body> </html>
servlet
com.tht.customer.servlet.CustomerServlet.java
package com.tht.customer.servlet; import java.io.IOException; import java.io.PrintWriter; import java.util.List; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.displaytag.pagination.Pagination; import org.displaytag.tags.TableTagParameters; import org.displaytag.util.ParamEncoder; import com.tht.common.db.base.BaseDao; import com.tht.common.oracle.paging.PageTools; import com.tht.customer.dao.CustomerDao; import com.tht.customer.vo.CustomerVO; public class CustomerServlet extends HttpServlet { /** * Constructor of the object. */ public CustomerServlet() { super(); } /** * Destruction of the servlet. <br> */ public void destroy() { super.destroy(); // Just puts "destroy" string in log // Put your code here } /** * The doGet method of the servlet. <br> * * This method is called when a form has its tag value method equals to get. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { //int resultSize=100;//总页数 int pageSize=5;//每页显示的记录数 //得到当前页的字符串 String strP=request.getParameter((new ParamEncoder("item").encodeParameterName(TableTagParameters.PARAMETER_PAGE))); //请求的需要显示的页码数 int currentPage=0; if(strP==null){ currentPage=1; }else{ currentPage=Integer.parseInt(strP); } //当前页 System.out.println("currentPage:"+currentPage); //排序功能 int sortIndex=-1;//排序索引列,第一列为0 int orderIndex=-1;//1为升序,2为降序 String strSort= request.getParameter((new ParamEncoder("item").encodeParameterName(TableTagParameters.PARAMETER_SORT))); if(strSort==null){ sortIndex=-1; }else{ sortIndex=Integer.parseInt(strSort); } System.out.println("sortIndex:"+sortIndex); String strOrder= request.getParameter((new ParamEncoder("item").encodeParameterName(TableTagParameters.PARAMETER_ORDER))); if(strOrder==null){ orderIndex=-1; }else{ orderIndex=Integer.parseInt(strOrder); } System.out.println("orderIndex:"+orderIndex); //总记录数 int totalCount=new BaseDao<CustomerServlet>().getTotalCount("select count(*) from ct_cuinfo"); PageTools pagination=new PageTools(currentPage,pageSize,totalCount); pagination.setSortIndex(sortIndex); pagination.setOrderIndex(orderIndex); CustomerDao customerDao=new CustomerDao(); List<CustomerVO> list=customerDao.getList(pagination); System.out.println("==============servlet============"); for(CustomerVO vo:list){ System.out.println(vo.getId()); } request.setAttribute("list", list); request.setAttribute( "pageSize" , pageSize); // 每页显示的条数 request.setAttribute( "resultSize" , totalCount); // 将总记录数保存成Intger实例保存在request中 request.getRequestDispatcher("/result.jsp").forward(request, response); } /** * The doPost method of the servlet. <br> * * This method is called when a form has its tag value method equals to post. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); out .println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">"); out.println("<HTML>"); out.println(" <HEAD><TITLE>A Servlet</TITLE></HEAD>"); out.println(" <BODY>"); out.print(" This is "); out.print(this.getClass()); out.println(", using the POST method"); out.println(" </BODY>"); out.println("</HTML>"); out.flush(); out.close(); } /** * Initialization of the servlet. <br> * * @throws ServletException if an error occurs */ public void init() throws ServletException { // Put your code here } }
发表评论
-
EL表达式 if else
2011-02-24 14:46 7598<c:choose> <c:wh ... -
display table 外部分页 支持当前页排序
2011-01-18 07:50 1597display table 外部分页 支持当前排序 ... -
display table 外部分页 不支持排序
2011-01-18 07:29 1514display table 外部分页 不支持排序 ... -
JSP获得项目根路径
2011-01-17 13:16 6307<%=request.getContextPath() ... -
JSP注释,在浏览器查看源代码时,看不到此界面
2010-12-29 13:52 1481JSP注释,在浏览器查看源代码时,看不到此界面 < ... -
distag table 求和
2010-10-28 22:07 1125distag table页面示示表格后,需要对某列进行求和运算 ... -
distag table 求和
2010-10-28 22:07 1089distag table页面示示表格后,需要对某列进行求和运算 ...
相关推荐
在IT行业中,"display table 外部分页 不支持排序"是一个常见的前端开发问题,尤其是在处理大量数据时。Display table通常指的是HTML中的`<table>`元素,用于展示表格数据。外部分页则是指将数据分块加载,而不是一...
"display table 外部分页 支持当前页排序"这个主题聚焦于如何在网页上有效地显示大量表格数据,同时提供分页功能和当前页面的排序能力。这种技术常用于Web应用程序,如后台管理系统、数据分析平台等,旨在提升用户...
<table id="flexTable" style="display: none"></table> ``` c. 编写JavaScript代码初始化FlexiGrid: ```javascript $(document).ready(function(){ var grid=$("#flexTable").flexigrid({ width: 760, ...
通过设置`border`、`padding`、`color`、`font-family`等属性调整表格的外观,使用`width`、`height`控制尺寸,`display: table-cell`确保元素按表格布局排列。 4. JavaScript与jQuery JavaScript和jQuery可以用来...
6. 代码结构与模块化:在给出的内容中可以看到,表格的HTML结构使用了`<table>`元素,并且每一列的表头都附加了排序功能(通过鼠标悬停时显示的上下箭头)。这表示实现分页功能的同时,还可以提供列排序的功能。同时...
可能还会涉及到现代前端框架(如Bootstrap)中预设的表格样式,或者使用JavaScript和jQuery实现交互效果,如排序、筛选和分页。 标签中的“工具”可能暗示着一些辅助工具或库,比如CSS预处理器(如Sass、Less)能...
4. **使用标签**:在JSP页面中,使用Displaytag的标签如`<display:table>`、`<display:column>`等来定义表格和列。 5. **配置属性**:通过设置标签的属性,如`export`, `sort`, `paging`等,来开启或调整Displaytag...
2. **link 和 @import 区别**:`link`是HTML标签,用于引入外部CSS文件,可实现异步加载,支持浏览器缓存,同时可以实现DNS预解析,加载性能更好;`@import`是CSS语法,只能在CSS文件内部使用,会阻塞页面渲染直到...
<class name="MyContent" table="jc_mycontent"> <meta attribute="sync-DAO">false</meta> <cache usage="read-write"/> <id name="id" type="java.lang.Integer" column="id"><generator class=...