锘??xml version="1.0" encoding="utf-8" standalone="yes"?>
]]>
<?xml version="1.0" encoding="UTF-8"?>
<votes voteTotalCount="0">
<vote voteId="1" name="c璇█ " voteCount="0" percentum="0" />
<vote voteId="2" name="c++" voteCount="0" percentum="0" />
<vote voteId="3" name="java" voteCount="0" percentum="0" />
<vote voteId="4" name="姹囩紪璇█" voteCount="0" percentum="0" />
</votes>
鍦ㄤ綘鐨剋eb搴旂敤鐨勬牴鐩綍寤虹珛xml鏂囦歡澶癸紝灝嗗叾鎷瘋礉鍒拌鐩綍涓嬨?/p>
浜屻佸緩绔媥ml瀵瑰簲鐨刡ean
/**
* @author flustar
* @version 鍒涘緩鏃墮棿錛欽ul 11, 2007 5:17:53 PM
* 綾昏鏄?/p>
*/
……………………………………………………………………….
……………………………………………………………………….
public class VoteBean {
private String voteId;
private String name;
private String voteCount;
private String voteTotalCount;
private String percentum;
public VoteBean() {
}
public String getPercentum() {
return percentum;
}
public void setPercentum(String percentum) {
this.percentum = percentum;
}
public String getVoteId() {
return voteId;
}
public void setVoteId(String voteId) {
this.voteId = voteId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getVoteCount() {
return voteCount;
}
public void setVoteCount(String voteCount) {
this.voteCount = voteCount;
}
}
涓夈佸緩绔嬪鐞嗗叿浣撻昏緫鐨剆ervice
package com.flustar.service;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.jdom.Attribute;
import org.jdom.Document;
import org.jdom.Element;
import org.jdom.input.SAXBuilder;
import org.jdom.output.Format;
import org.jdom.output.XMLOutputter;
import org.jdom.xpath.XPath;
import com.flustar.web.beans.VoteBean;
import com.flustar.web.config.ContextConfig;
public class VoteService {
private Element root, vote;
private Document doc;
private Attribute voteTotalCount;
private VoteBean voteBean;
private List<VoteBean> voteBeanList;
private String path = ContextConfig.getContextPath()
+ "/xml/vote.xml";
public void buildDoc() throws Exception {
FileInputStream fi = null;
fi = new FileInputStream(path);
SAXBuilder sb = new SAXBuilder();
doc = sb.build(fi);
}
public void formatDoc() throws Exception {
Format format = Format.getCompactFormat();
format.setEncoding("UTF-8");// 璁劇疆xml鏂囦歡鐨勫瓧絎︿負(fù)UTF-8
format.setIndent(" ");// 璁劇疆xml鏂囦歡緙╄繘涓?涓┖鏍?/p>
XMLOutputter xmlOut = new XMLOutputter(format);
xmlOut.output(doc, new FileOutputStream(path));
}
public String floatToPercentum(Double doubleNum) {
NumberFormat numberFormat = NumberFormat.getPercentInstance();
numberFormat.setMinimumFractionDigits(2);
// numberFormat.setMaximumIntegerDigits(2);
String str = numberFormat.format(doubleNum);
//System.out.println(str);
return str;
}
public void updateVoteCount(String voteId) throws Exception {
buildDoc();
root = doc.getRootElement();
vote = (Element) XPath.selectSingleNode(root, "http://vote[@voteId='"
+ voteId + "']");
int voteCount = Integer.parseInt(vote.getAttributeValue("voteCount")) + 1;
//System.out.println(voteCount);
vote.setAttribute("voteCount", String.valueOf(voteCount));
int totalCount = Integer.parseInt(root
.getAttributeValue("voteTotalCount")) + 1;
voteTotalCount = new Attribute("voteTotalCount", String
.valueOf(totalCount));
root.setAttribute(voteTotalCount);
System.out.println(totalCount);
formatDoc();
updateAllVoteCount();//鏇存柊鎵鏈夌殑鐧懼垎姣?/p>
}
public void updateAllVoteCount()throws Exception{
buildDoc();
root=doc.getRootElement();
int totalCount = Integer.parseInt(root
.getAttributeValue("voteTotalCount"));
List voteList=XPath.selectNodes(root,"/votes/vote");
for(int i=0;i<voteList.size();i++){
vote=(Element)voteList.get(i);
int voteCount = Integer.parseInt(vote.getAttributeValue("voteCount"));
System.out.println(voteCount);
vote.setAttribute("voteCount", String.valueOf(voteCount));
vote.setAttribute("percentum", floatToPercentum(1.0 * voteCount
/ totalCount));
}
formatDoc();
}
public List getAllVote() throws Exception {
buildDoc();
voteBeanList = new ArrayList();
root = doc.getRootElement();
String totalCount = root.getAttributeValue("voteTotalCount");
List voteList = root.getChildren();
Iterator i = voteList.iterator();
while (i.hasNext()) {
voteBean = new VoteBean();
voteBean.setVoteTotalCount(totalCount);
vote = (Element) i.next();
String name = vote.getAttributeValue("name");
String voteCount = vote.getAttributeValue("voteCount");
String percentum = vote.getAttributeValue("percentum");
voteBean.setName(name);
voteBean.setVoteCount(voteCount);
voteBean.setPercentum(percentum);
voteBeanList.add(voteBean);
}
return voteBeanList;
}
}
public String getVoteTotalCount() {
return voteTotalCount;
}
public void setVoteTotalCount(String voteTotalCount) {
this.voteTotalCount = voteTotalCount;
}
}
鍥涖佽幏鍙栦笂涓嬫枃璺緞鐨刲istener
package com.flustar.web.listener;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import com.flustar.web.config.ContextConfig;
public class ConfigLoadContextListener implements ServletContextListener{
public void contextDestroyed(ServletContextEvent arg0) {
// TODO Auto-generated method stub
}
public void contextInitialized(ServletContextEvent contextEvent) {
// TODO Auto-generated method stub
String contextPath = contextEvent.getServletContext().getRealPath("/");
ContextConfig.setContextPath(contextPath);
}
}
………………………………………………………..
……………………………………………………………
public class ContextConfig {
private static String contextPath;
public static String getContextPath() {
return contextPath;
}
public static void setContextPath(String contextPath) {
ContextConfig.contextPath = contextPath;
}
……………………………………………………………………
………………………………………………………………..
}
浜斻佸湪applicationContext-service.xml涓敞鍐孷oteService
<bean name="voteService" class="com.flustar.service.imp.VoteService"/>
鍏佹敞鍐寈ml錛屽湪浣犵殑web搴旂敤鐨刉EB-INFO鐩綍涓嬪緩绔媋pplicationContext-dwr.xml鏂囦歡錛屽唴瀹逛負(fù)錛?/p>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE dwr PUBLIC "-//GetAhead Limited//DTD Direct Web Remoting 2.0//EN" "http://getahead.org/dwr/dwr20.dtd">
<dwr>
<allow>
<create creator="spring" javascript="VoteService" >
<param name="beanName" value="voteService"></param>
<include method="updateVoteCount"/>
<include method="getAllVote"/>
</create>
<convert converter="bean" match="com.flustar.web.beans.VoteBean" />
</allow>
</dwr>
涓冦佷慨鏀箇eb.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
…………………………………………………………………………………………………………………………
………………………………………………………………………………………………………………………………..
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
…………………………………..
/WEB-INF/classes/applicationContext-service.xml
</param-value>
</context-param>
……………………………………………………………………………………………………………………………………………. <listener-class>com.flustar.web.listener.ConfigLoadContextListener</listener-class>
…………………………………………………………………………………………………………………………………………….
<servlet>
<servlet-name>dwr-invoker</servlet-name>
<servlet-class>org.directwebremoting.servlet.DwrServlet</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>true</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>dwr-invoker</servlet-name>
<url-pattern>/dwr/*</url-pattern>
</servlet-mapping>
…………………………………………………………………………………………………………………………………………….
</web-app>
鍏乯sp欏甸潰
1)
<%@ page contentType="text/html; charset=gbk" language="java" import="java.sql.*" errorPage="" %>
<html>
<head>
<title>鎶曠エ緋葷粺</title>
<script type='text/javascript' src='dwr/engine.js'> </script>
<script type='text/javascript' src='dwr/util.js'> </script>
<script type='text/javascript' src='dwr/interface/VoteService.js'> </script>
<script type='text/javascript'>
function vote(){
var obj=document.getElementsByName('radio');
if (obj!=null){
var j=0;
for (var i=0;i<obj.length;i++){
if (obj[i].checked)
{
VoteService.updateVoteCount(obj[i].value);
alert("鎶曠エ鎴愬姛!");
obj[i].checked=false;
break;
}
}
j=j+1;
}
if(j==obj.length){
alert("璇烽変腑鍏朵腑鐨勪竴欏癸紝鍐嶆姇紲?");
}
}
}
function showwin(){
window.open('voteresult.htm','voteresult','height=400, width=400, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no');
}
}
</script>
</head>
<body>
<div >
<h1 >
浣犱嬌鐢ㄦ渶澶氱殑涓闂ㄨ璦鏄紵
</h1>
</div>
<div>
<div>
<span> <h1><input type="radio" name="radio" id="radio" value="1" />
C璇█</h1>
</span>
<span> <h1 ><input type="radio" name="radio" id="radio" value="2" />c++ </h1> </span>
<span ><h1 ><input type="radio" name="radio" id="radio" value="3" />java </h1> </span>
<span><h1 ><input type="radio" name="radio" id="radio" value="4"/>姹囩紪璇█</h1> </span>
</div>
</div>
<div id="toupiao"><input class="btn" type="button" value="鎶曠エ" onClick="vote()" /><input class="btn" type="button" value="鏌ョ湅" onClick="showwin()"/></div>
</body>
</html>
2)
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<title>鎶曠エ緇撴灉</title>
<script type='text/javascript' src='dwr/engine.js'> </script>
<script type='text/javascript' src='dwr/util.js'> </script>
<script type='text/javascript' src='dwr/interface/VoteService.js'> </script>
<script type='text/javascript' >
function showresult(){
VoteService.getAllVote(function(data){
document.getElementById("totalCount").innerHTML=data[0].voteTotalCount;
for(var i=0;i<data.length;i++){
var voteBean=data[i];
document.getElementById("xuanshou"+i).innerHTML=voteBean.name;
document.getElementById("baifenbi"+i).innerHTML=voteBean.percentum;
document.getElementById("piaoshu"+i).innerHTML=voteBean.voteCount;
document.getElementById("img"+i).width=voteBean.voteCount/data[0].voteTotalCount*310;
}
});
}
</script>
</head>
<body onLoad="showresult()">
<div id="voteRs">
<table border="0" cellpadding="0" cellspacing="0">
<CAPTION valign="top" class="subject">
鎶曠エ緇撴灉
</CAPTION>
<tbody>
<tr >
<th>璇█</th>
<th>鐧懼垎姣?lt;/th>
<th>紲ㄦ暟</th>
</tr>
<tr>
<td><span id="xuanshou0"></span></td>
<td><span id="baifenbi0"></span><img id="img0" src='images/voteprogress.gif' width=0 height=10></td>
<td><span id="piaoshu0"></span></td>
</tr>
<tr>
<td><span id="xuanshou1"></span></td>
<td><span id="baifenbi1"></span><img id="img1" src='images/voteprogress.gif' width=0 height=10></td>
<td><span id="piaoshu1"></span></td>
</tr>
<tr>
<td><span id="xuanshou2"></span></td>
<td><span id="baifenbi2"></span><img id="img2" src='images/voteprogress.gif' width=0 height=10></td>
<td><span id="piaoshu2"></span></td>
</tr>
<tr>
<td><span id="xuanshou3"></span></td>
<td><span id="baifenbi3"></span><img id="img3" src='images/voteprogress.gif' width=0 height=10></td>
<td><span id="piaoshu3"></span></td>
</tr>
</tbody>
</table>
鍏?lt;span id="totalCount"></span>鏉℃姇紲?lt;br/>
[<span onClick="javascript:window.close();">鍏抽棴紿楀彛</span>]
</div>
</body>
</html>
public class PaginationSupport{
public final static int PAGESIZE = 30;
private int pageSize = PAGESIZE;
private List items;
private int totalCount;
private int[] indexes = new int[0];
private int startIndex = 0;
public PaginationSupport(List items, int totalCount) {
setPageSize(PAGESIZE);
setTotalCount(totalCount);
setItems(items);
setStartIndex(0);
}
public PaginationSupport(List items, int totalCount, int startIndex) {
setPageSize(PAGESIZE);
setTotalCount(totalCount);
setItems(items);
setStartIndex(startIndex);
}
public PaginationSupport(List items, int totalCount, int pageSize,
int startIndex) {
setPageSize(pageSize);
setTotalCount(totalCount);
setItems(items);
setStartIndex(startIndex);
}
public List getItems() {
return items;
}
public void setItems(List items) {
this.items = items;
}
public int getPageSize() {
return pageSize;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public int getTotalCount() {
return totalCount;
}
public void setTotalCount(int totalCount) {
if (totalCount > 0) {
this.totalCount = totalCount;
int count = totalCount / pageSize;
if (totalCount % pageSize > 0)
count++;
indexes = new int[count];
for (int i = 0; i < count; i++) {
indexes[i] = pageSize * i;
}
} else {
this.totalCount = 0;
}
}
public int[] getIndexes() {
return indexes;
}
public void setIndexes(int[] indexes) {
this.indexes = indexes;
}
public int getStartIndex() {
return startIndex;
}
public void setStartIndex(int startIndex) {
if (totalCount <= 0)
this.startIndex = 0;
else if (startIndex >= totalCount)
this.startIndex = indexes[indexes.length - 1];
else if (startIndex < 0)
this.startIndex = 0;
else {
this.startIndex = indexes[startIndex / pageSize];
}
}
public int getNextIndex() {
int nextIndex = getStartIndex() + pageSize;
if (nextIndex >= totalCount)
return getStartIndex();
else
return nextIndex;
}
public int getPreviousIndex() {
int previousIndex = getStartIndex() - pageSize;
if (previousIndex < 0)
return 0;
else
return previousIndex;
}
public int getPageCount() {
int count = totalCount / pageSize;
if (totalCount % pageSize > 0)
count++;
return count;
}
public int getCurentPageNum() {
return getStartIndex() / pageSize + 1;
}
}
鍦ㄨ繖涓垎欏電被涓瀹氫簡姣忛〉瑕佹樉紺虹殑璁板綍鏁頒互鍙婂紑濮嬬儲寮曪紝濡傛灉鐢ㄦ櫘閫氱殑jsp鏉ュ彇榪欎釜鍒嗛〉綾葷殑鏁版嵁榪樺彲浠ワ紝浣嗘槸浣跨敤spring+hibernate榪欑鏋舵瀯灝辨樉寰楁瘮杈冮夯鐑︼紙鍘熷洜鏄痵pring MVC榪斿洖鐨勬槸涓涓?nbsp;PaginationSupport鐨勫璞★紝浣跨敤jstl浣滀負(fù)鍓嶇鏄劇ず鐨勮瘽錛屼細(xì)鍦╦sp欏甸潰涓幒鏉傚ぇ閲忕殑璁$畻錛屽儚涓嬩竴欏電儲寮曪紝鍏卞灝戞潯璁板綍錛屽綋鍓嶇鍑犻〉錛屽叡澶氬皯欏電瓑絳変細(xì)浣縥sp寰堥毦緇存姢錛変笅闈㈡槸瀵硅繖涓被鐨勬敼榪涳細(xì)
public class PaginationSupport {
public final static int PAGESIZE = 30;
private int pageSize = PAGESIZE;
private int totalCount;
private int currentPage;
private int startIndex;
private int[] indexes = new int[0];
private int nextIndex;
private int previousIndex;
private int pageCount;
private List items;
private int lastIndex;
public PaginationSupport(int pageSize,
int startIndex) {
setPageSize(pageSize);
setStartIndex(startIndex);
}
public PaginationSupport(List items, int totalCount) {
setPageSize(PAGESIZE);
setTotalCount(totalCount);
setItems(items);
setStartIndex(0);
}
public PaginationSupport(List items, int totalCount, int startIndex) {
setPageSize(PAGESIZE);
setTotalCount(totalCount);
setItems(items);
setStartIndex(startIndex);
}
public PaginationSupport(List items, int totalCount, int pageSize,
int startIndex) {
setPageSize(pageSize);
setTotalCount(totalCount);
setItems(items);
setStartIndex(startIndex);
}
public void setTotalCount(int totalCount) {
if (totalCount > 0) {
this.totalCount = totalCount;
int count = totalCount / pageSize;
if (totalCount % pageSize > 0)
count++;
indexes = new int[count];
for (int i = 0; i < count; i++) {
indexes[i] = pageSize * i;
}
} else {
this.totalCount = 0;
}
}
public int getTotalCount() {
return totalCount;
}
public void setIndexes(int[] indexes) {
this.indexes = indexes;
}
public int[] getIndexes() {
return indexes;
}
public void setStartIndex(int startIndex) {
if (totalCount <= 0)
this.startIndex = 0;
else if (startIndex >= totalCount)
this.startIndex = indexes[indexes.length - 1];
else if (startIndex < 0)
this.startIndex = 0;
else {
this.startIndex = indexes[startIndex / pageSize];
}
}
public int getStartIndex() {
return startIndex;
}
public void setNextIndex(int nextIndex) {
this.nextIndex = nextIndex;
}
public int getNextIndex() {
int nextIndex = getStartIndex() + pageSize;
if (nextIndex >= totalCount)
return getStartIndex();
else
return nextIndex;
}
public void setPreviousIndex(int previousIndex) {
this.previousIndex = previousIndex;
}
public int getPreviousIndex() {
int previousIndex = getStartIndex() - pageSize;
if (previousIndex < 0)
return 0;
else
return previousIndex;
}
public void setPageCount(int pageCount) {
this.pageCount = pageCount;
}
public int getPageCount() {
int count = totalCount / pageSize;
if (totalCount % pageSize > 0)
count++;
return count;
}
public int getCurrentPage() {
return getStartIndex() / pageSize + 1;
}
public void setCurrentPage(int currentPage) {
this.currentPage = currentPage;
}
public void setLastIndex(int lastIndex) {
this.lastIndex =lastIndex ;
}
public int getLastIndex() {
return indexes[indexes.length-1];
}
public int getPageSize() {
return pageSize;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public List getItems() {
return items;
}
public void setItems(List items) {
this.items = items;
}
}
浠ヤ笂鏄垎欏電殑灝佽綾伙紝涓嬮潰鏄敮鎸佸垎欏墊煡璇㈢殑鏂規(guī)硶錛?br />
1錛?br />
public PaginationSupport findPageByCriteria(
final DetachedCriteria detachedCriteria, final int pageSize,
final int startIndex) {
return (PaginationSupport) getHibernateTemplate().execute(
new HibernateCallback() {
public Object doInHibernate(Session session)
throws HibernateException {
Criteria criteria = detachedCriteria
.getExecutableCriteria(session);
int totalCount = ((Integer) criteria.setProjection(
Projections.rowCount()).uniqueResult())
.intValue();
criteria.setProjection(null);
List items = criteria.setFirstResult(startIndex)
.setMaxResults(pageSize).list();
PaginationSupport ps = new PaginationSupport(items,
totalCount, pageSize, startIndex);
return ps;
}
}, true);
}
2錛?br />
public PaginationSupport findPageByQuery( final String hsql, final int pageSize,final int startIndex){
return (PaginationSupport)getHibernateTemplate().execute(
new HibernateCallback() {
public Object doInHibernate(Session session) throws HibernateException, SQLException {
Query query = session.createQuery(hsql);
int totalCount=query.list().size();
query.setFirstResult(startIndex);
query.setMaxResults(pageSize);
List items = query.list();
PaginationSupport ps = new PaginationSupport(items,
totalCount, pageSize, startIndex);
return ps;
}
},true);
}
浣犱篃璁鎬細(xì)闂垎欏墊煡璇負(fù)浠涔堜細(xì)鎻愪緵涓や釜鏂規(guī)硶錛岃繖涓や釜鏂規(guī)硶鏈夊尯鍒悧錛熷叾瀹炶繖涓や釜鏂規(guī)硶騫舵棤鏈川鍖哄埆錛孌etachedCriteria 涔熸槸鏋勯犳煡璇㈣鍙ョ殑涓嶲uery鍔熻兘涓鑷達(dá)紝浣嗘槸瀹冩彁渚涗簡鏇村姞闈㈠悜瀵硅薄鐨勬柟娉曟潵鍐檋sql璇彞銆備竴鑸漢浠兘鍊懼悜絎竴縐嶆柟娉曪紝浣嗘槸榪欑鏂規(guī)硶騫朵笉閫氱敤錛屽畠鏈変竴縐嶆煡璇㈠茍涓嶆敮鎸侊紝閭e氨鏄綋浣犺鏌ヨ鐨勫璞″茍涓嶆槸涓涓崟涓瀵硅薄鐨勮瘽錛堜緥濡?浣犲湪鏁版嵁搴撲腑鏈変袱涓〃錛屼竴涓槸user,鍙︿竴涓槸userinfo,榪欎袱涓〃鎵瀵瑰簲鐨勫璞″湪hiberante涓鎸囧畾涓哄叡浜富閿殑璇濓紝鍦ㄦ墽琛屾煡璇㈢殑鏃跺欏氨浼?xì)鎶ゾc誨瀷杞崲寮傚父錛屽師鍥犳槸鏌ヨ鍑烘潵鐨勫璞″茍涓嶆槸user鑰屾槸涓涓寘鍚玼ser 鍜寀serinfo鐨凮bject,浣犺嫢寮哄埗鎶婂畠杞崲鎴恥ser綾誨瀷錛岃偗瀹氫細(xì)鍑洪敊),榪欐椂浣犱笉寰椾笉閲囩敤絎簩涓柟娉曘傚綋鐒惰繖鍙槸鎴戜釜浜鴻瑙o紝涔熻榪樻湁鍦版柟璇寸殑涓嶆槸寰堝噯紜紝甯屾湜澶у澶氬鎵硅瘎鎸囨銆?br />
鏈鍚庢槸榪欎釜鍒嗛〉綾葷殑鍓嶅彴鏄劇ず婧愪唬鐮?
<%@ page language="java" contentType="text/html; charset=gbk"
pageEncoding="GBK"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link type="text/css" rel="stylesheet" href="../css/panel.css">
<title>鏄劇ず鎵鏈夌敤鎴?lt;/title>
</head>
<body>
<div style="margin:20px auto 30px; width:70%;"><a href="index.jsp" class="btn2">榪斿洖棣栭〉</a></div>
<div style="margin:10px auto 0; width:70%;">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<caption>
鏄劇ず鎵鏈夌敤鎴?br />
</caption>
<tr>
<td>鐢ㄦ埛ID</td>
<td>鐢ㄦ埛鍚?lt;/td>
<td>鐢ㄦ埛鏄電О</td>
<td>鐢?shù)瀛愰偖錃g</td>
<td>娉ㄥ唽鏃墮棿</td>
<td>璇︾粏淇℃伅</td>
<td>鐢ㄦ埛鍏呭艱褰?lt;/td>
<td>鐢ㄦ埛瀹氬埗鏈嶅姟淇℃伅</td>
</tr>
<c:forEach var="user" items="${userPage.items}">
<tr>
<td>${user.intId}</td>
<td>${user.username}</td>
<td>${user.name}</td>
<td>${user.email}</td>
<td><fmt:formatDate value='${user.creationTime}' pattern='yyyy-MM-dd HH:mm' /></td>
<td><a href="user_getdetailUser.ado?userId=${user.intId}" class="btn">璇︾粏淇℃伅</a></td>
<td><a href="orderService_getUserAccountAdds.ado?userId=${user.intId}" class="btn">鐢ㄦ埛鍏呭艱褰?lt;/a></td>
<td><a href="orderService_getUserChargeItems.ado?userId=${user.intId}" class="btn">鐢ㄦ埛瀹氬埗鏈嶅姟淇℃伅</a></td>
</tr>
</c:forEach>
</table>
<c:if test="${!empty userPage}">
鍏?{userPage.totalCount}璁板綍
<c:choose>
<c:when test="${userPage.startIndex ne '0'}">
<a href="user_getPage.ado?startIndex=0">棣栭〉</a>
</c:when>
<c:otherwise>
棣栭〉
</c:otherwise>
</c:choose>
<c:choose>
<c:when test="${userPage.previousIndex lt userPage.startIndex}">
<a href="user_getPage.ado?startIndex=${userPage.previousIndex }">涓婁竴欏?lt;/a>
</c:when>
<c:otherwise>
涓婁竴欏?br />
</c:otherwise>
</c:choose>
<c:choose>
<c:when test="${userPage.nextIndex>userPage.startIndex}">
<a href="user_getPage.ado?startIndex=${userPage.nextIndex}">涓嬩竴欏?lt;/a>
</c:when>
<c:otherwise>
涓嬩竴欏?br />
</c:otherwise>
</c:choose>
<c:choose>
<c:when test="${userPage.lastIndex eq userPage.startIndex}">
鏈鍚庝竴欏?br />
</c:when>
<c:otherwise>
<a href="user_getPage.ado?startIndex=${userPage.lastIndex}">鏈鍚庝竴欏?lt;/a>
</c:otherwise>
</c:choose>
姣忛〉鏄劇ず${userPage.pageSize}鏉¤褰?
褰撳墠絎?{userPage.currentPage }/${userPage.pageCount}欏?br />
</c:if>
</div>
</body>
</html>