81,091
社区成员
发帖
与我相关
我的任务
分享
<%@ page language="java" pageEncoding="utf-8"%>
<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>数据显示</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>
<script type="text/javascript">
function del(id)
{
if(confirm("是否要删除吗?"))
{
//method = "post";
action = "curd!command.do?action=delete&uid="+id;
window.location.href="curd!command.do?action=list";
submit();
}
}
function addPage(btn)
{
var btnvalue=btn.value;
if(btnvalue=="go")
{
var id=document.frm.name.value;
if(id.length>0)
{
document.frm.action="curd!command.do?action=list&startIndex="+(id-1)*5;
document.frm.submit();
}else
{
alert('please input the message');
document.getElementsByName('name').focus();
}
}
else
{
window.location.href="curd!command.do?action=list";
submit();
}
}
</script>
<body>
<form action="">
<table border="0" cellpadding="4" cellspacing="4">
<tr>
<td>ID</td>
<td>Name</td>
<td>pass</td>
<td>add</td>
<td>delete</td>
<td>update</td>
<td>details</td>
</tr>
<s:iterator value="#request.list" var="list" status="s">
<tr>
<td><s:property value="id"/></td>
<td><s:property value="name"/></td>
<td><s:property value="password"/></td>
<td><a href="javascript:del(<s:property value="id"/>);"><img src="image/add.gif"/></a></td>
<td><a href="curd!command.do?action=delete&uid=<s:property value="id"/>"><img src="image/del.gif"/></a></td>
<td><a href="curd!command.do?action=update&uid=<s:property value="id"/>"><img src="image/up.gif"/></a></td>
<td><a href="curd!command.do?action=detail&uid=<s:property value="id"/>"><img src="image/detail.gif"/></a></td>
</tr>
</s:iterator>
</table>
<table width="100%" border="0" cellpadding="2" cellspacing="0" bordercolor="#4dddE7">
<tr bgcolor="#FFFFFF">
<td width="17%">${ ps.totalCount }
<a href="curd!command.do?action=list&startIndex=0"><img src="image/shou_r19_c4.jpg"/></a>
<a href="curd!command.do?action=list&startIndex=${ps. previousIndex}"><img src="image/shou_r19_c3.jpg"/></a>
<s:iterator var="i" value="#request.page">
<s:if test="#i==-1">
...
</s:if>
<s:elseif test="#i==#request.ps.currentPage">
<a href="curd!command.do?action=list&startIndex=${(i-1)*5 }" target="mainFrame" style="color:red;" >${i }</a>
</s:elseif>
<s:else>
<a href="curd!command.do?action=list&startIndex=${(i-1)*5 }" target="mainFrame">${i }</a>
</s:else>
</s:iterator>
跳转到第<select name="startIndex">
<option value="-1">please</option>
<s:iterator var="it" value="#request.item" status="st">
<s:iterator value="it" var="d" status="s">
<option value="${d }">the <fmt:formatNumber pattern="#" type="number" value="${(d/5)+1}" maxFractionDigits="0"/> page</option>
</s:iterator>
</s:iterator>
</select>页
<a href="curd!command.do?action=list&startIndex=${ps.nextIndex}"><img src="image/shou_r19_c2.jpg"/></a>
<a href="curd!command.do?action=list&startIndex=${ps.lastPage }"><img src="image/shou_r19_c5.jpg"/></a>
${ ps.pages } / ${ ps.currentPage }
</td>
</tr>
</table>
</form>
<form action="#" name="frm" method="post">
<input id ="name" type="text" value="" name="d"/>
<input type="submit" name="submit" value="go" onclick="addPage(this);">
<table>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<c:forEach items="${list}" var="item" varStatus="s">
<c:if test="${s.index%2==0}"><tr></c:if>
<td>${item.name}</td>
<c:if test="${l%2==1}"></tr></c:if>
</c:forEach>
</table>
</form>
</body>
</html>