📄 student_list.jsp
字号:
<%@ page contentType="text/html;charset=GB2312" %>
<%@ page import="student.dao.*,java.util.*,commons.PageInation" %>
<HTML>
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/student.css">
<BODY>
<%String path=request.getContextPath();
ArrayList datalist=(ArrayList)request.getAttribute("DataList");
if(datalist==null){
datalist=new ArrayList();
}
request.removeAttribute("DataList");
PageInation pageInation=(PageInation)request.getAttribute("PageInation");
request.removeAttribute("PageInation");
%>
<center>
<table border=1>
<tr>
<td align="center">
<%
UserInfo user=(UserInfo)request.getSession().getAttribute("user");
if(user==null) {
%>
<form name="loginfrm" method="post" action="<%=path %>/servlet/LoginAction">
<table border=1>
<tr><td colspan="2">登录页面</td></tr>
<tr><td>用户名</td><td><input type="text" name="userName" value=""></td></tr>
<tr><td>密码</td><td><input type="password" name="pwd" value=""></td></tr>
<tr><td colspan="2">
<select name="type">
<option value="user">普通用户</option>
<option value="admin">管理员</option>
</select>
</td></tr>
<tr><td colspan="2"><input type="button" value="提交" onclick="check();"></td></tr>
</table>
</form>
<%}else{ %>
Welcome <%=user.getUserName() %>
<form name="exitfrm">
<a href="javascript:exit();">exit</a>
</form>
<%} %>
</td>
<td align="center">2</td>
</tr>
<tr>
<td align="center">3</td>
<td align="center">
<form name=frm>
<input type="hidden" name="currentPage" value="<%=pageInation.getCurrentPage()%>">
<input type="hidden" name="totalCount" value="<%=pageInation.getTotalCount()%>">
<input type="hidden" name="pageSize" value="<%=pageInation.getPageSize()%>">
<table border=1>
<tr>
<%
for(int i=0;i<datalist.size();i++){
StudentInfo st=(StudentInfo)datalist.get(i);
if(i%2==0){
%>
<tr>
<%} %>
<td>
<table border=1>
<tr><td width="60"><%=st.getId()==null?"":st.getId()%></td>
<td rowspan="5">
<img src="<%=path%>/upFile/<%=st.getPhoto()==null?"":st.getPhoto() %>" width=120 height=150>
</a>
</td></tr>
<tr><td><%=st.getName()==null?"":st.getName()%></td></tr>
<tr><td><%=st.getMath()==null?"":st.getMath()%></td></tr>
<tr><td><%=st.getEnglish()==null?"":st.getEnglish()%></td></tr>
<tr><td><%=st.getPhysic()==null?"":st.getPhysic()%></td></tr>
</table>
</td>
<%
if(i%2==1){
%>
</tr>
<%}
}%>
<tr>
<td colspan="2">
<TABLE bgColor="#C6E3FF" width="100%" height="25" cellpadding="0" cellspacing="0" >
<TR>
<TD align="right" bgColor="#C6E3FF">
共<%=pageInation.getTotalCount()%>条 | 每页<%=pageInation.getPageSize()%>条 | 第<%=pageInation.getCurrentPage()%>/<%=pageInation.getTotalPages()%>页 |
<% if(pageInation.getCurrentPage() >1){%>
<A HREF="javascript:gotoPage(1)">首页</A> |
<A HREF="javascript:gotoPage(<%=pageInation.getCurrentPage()-1%>)">上一页</A> |
<%}
else {%>
首页 |
上一页 |
<%}
if(pageInation.getCurrentPage() <pageInation.getTotalPages()){%>
<A HREF="javascript:gotoPage(<%=pageInation.getCurrentPage()+1%>)">下一页</A> |
<A HREF="javascript:gotoPage(<%=pageInation.getTotalPages()%>)">尾页</A> |
<%}
else {%>
下一页 |
尾页 |
<%}%>
<input type="button" value="GO" onclick="gotoPage(frm.pageNo.value)">
<input type="text" name="pageNo" size="3" >页
</TD>
</TR>
</TBODY>
</TABLE>
</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</center>
</BODY></HTML>
<<script type="text/javascript"><!--function gotoPage(pageno){
if(pageno <= <%=pageInation.getTotalPages()%> && pageno > 0){
document.frm.currentPage.value = pageno;
document.frm.action="<%=path%>/servlet/GetListAction";
document.frm.submit();
} else{
alert("请输入合法页码!");
return false;
}
}
function check(){
if(loginfrm.userName.value==""){
alert("userName excepted!");
return false;
}
if(loginfrm.pwd.value==""){
alert("password excepted!");
return false;
}
loginfrm.submit();
}
function exit(){
exitfrm.action="<%=path%>/servlet/ExitAction";
exitfrm.submit();
}//--></script>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -