用户注册



邮箱:

密码:

用户登录


邮箱:

密码:
记住登录一个月忘记密码?

发表随想


还能输入:200字
云代码 - java代码库

基于pager-taglib包Java Web的分页设计

2015-03-24 作者: java源代码大全举报

[java]代码库

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
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>pager-taglib DEMO</title>
	<script type="text/javascript" src="js/pager-taglib.js"></script>
  </head>
<body>
<hr/>
<h1>DEMO 1</h1>
<h2>有form标签的get提交,有form标签可以提供搜索条件</h2>
<h2>&ltjsp:param name=&quotparams&quot value=&quotname1:value1&quot/&gt:为分页组件提供而外参数,在无form标签时非常有用</h2>
<form action="servlet/PageServlet" method="get">
	a_name:<input name="a_name" value="${a_name }" type="text" title="搜索条件1"><br/>
	b_name:<input name="b_name" value="${b_name }" type="text" title="搜索条件2">
	<input type="submit" value="搜索"><br/><br/>
	<table class="data" border="1" cellpadding="5" cellspacing="0">
		<tr>
			<td height="39">名字</td>  
			<td height="39">数值</td>  
	     </tr>       
		<c:forEach items="${pageModel.list }" var="data">
		<tr>
			<td height="39">${data.name }</td>  
			<td height="39">${data.value }</td>  
	     </tr>       
		</c:forEach>
	</table>
	<br/>
<jsp:include page="pager.jsp" flush="true">
	<jsp:param name="url" value="servlet/PageServlet"/>
	<jsp:param name="items" value="${pageModel.totalCount }"/>
	<jsp:param name="params" value="name1:value1"/>
	<jsp:param name="params" value="name2:value2"/>
</jsp:include>
</form>

<br/><br/><hr/>
<h1>DEMO 2</h1>
<h2>有form标签的post提交,有form标签可以提供搜索条件</h2>
<h2>&ltjsp:param name=&quotparams&quot value=&quotname1:value1&quot/&gt:为分页组件提供而外参数,在无form标签时非常有用</h2>
<form action="servlet/PageServlet" method="post">
	a_name:<input name="a_name" value="${a_name }" type="text" title="搜索条件1"><br/>
	b_name:<input name="b_name" value="${b_name }" type="text" title="搜索条件2">
	<input type="submit" value="搜索"><br/><br/>
	<table class="data" border="1" cellpadding="5" cellspacing="0">
		<tr>
			<td height="39">名字</td>  
			<td height="39">数值</td>  
	     </tr>       
		<c:forEach items="${pageModel.list }" var="data">
		<tr>
			<td height="39">${data.name }</td>  
			<td height="39">${data.value }</td>  
	     </tr>       
		</c:forEach>
	</table><br/>
<jsp:include page="pager.jsp" flush="true">
	<jsp:param name="url" value="servlet/PageServlet"/>
	<jsp:param name="items" value="${pageModel.totalCount }"/>
	<jsp:param name="params" value="name1:value1"/>
	<jsp:param name="params" value="name2:value2"/>
</jsp:include>
</form>

<br/><br/><hr/>
<h1>DEMO 3</h1>
<h2>无form标签的提交,即用a标签跳转</h2>
<h2>&ltjsp:param name=&quotparams&quot value=&quotname1:value1&quot/&gt:为分页组件提供而外参数,在无form标签时非常有用</h2>
<table class="data" border="1" cellpadding="5" cellspacing="0">
	<tr>
		<td height="39">名字</td>  
		<td height="39">数值</td>  
     </tr>       
	<c:forEach items="${pageModel.list }" var="data">
	<tr>
		<td height="39">${data.name }</td>  
		<td height="39">${data.value }</td>  
     </tr>       
	</c:forEach>
</table><br/>
<jsp:include page="pager.jsp" flush="true">
	<jsp:param name="url" value="servlet/PageServlet"/>
	<jsp:param name="items" value="${pageModel.totalCount }"/>
	<jsp:param name="params" value="name1:value1"/>
	<jsp:param name="params" value="name2:value2"/>
</jsp:include>
<br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
</body>
</html>
//源代码片段来自云代码http://yuncode.net
			


网友评论    (发表评论)


发表评论:

评论须知:

  • 1、评论每次加2分,每天上限为30;
  • 2、请文明用语,共同创建干净的技术交流环境;
  • 3、若被发现提交非法信息,评论将会被删除,并且给予扣分处理,严重者给予封号处理;
  • 4、请勿发布广告信息或其他无关评论,否则将会删除评论并扣分,严重者给予封号处理。


扫码下载

加载中,请稍后...

输入口令后可复制整站源码

加载中,请稍后...