?? list_0002ejsp_jsp.java
字號:
import java.sql.*;
import com.bict.Common;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import org.apache.jasper.runtime.*;
public class list_0002ejsp_jsp extends HttpJspBase {
static {
}
public list_0002ejsp_jsp( ) {
}
private static boolean _jspx_inited = false;
public final void _jspx_init() throws org.apache.jasper.runtime.JspException {
}
public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
JspFactory _jspxFactory = null;
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page = this;
String _value = null;
try {
if (_jspx_inited == false) {
synchronized (this) {
if (_jspx_inited == false) {
_jspx_init();
_jspx_inited = true;
}
}
}
_jspxFactory = JspFactory.getDefaultFactory();
response.setContentType("text/html; charset=GBK");
pageContext = _jspxFactory.getPageContext(this, request, response,
"", true, 8192, true);
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
// HTML // begin [file="/list.jsp";from=(0,48);to=(1,0)]
out.write("\r\n");
// end
// HTML // begin [file="/list.jsp";from=(1,47);to=(13,0)]
out.write("\r\n<html>\r\n<head>\r\n<title>\r\nlist\r\n</title>\r\n</head>\r\n<center>\r\n<body bgcolor=\"#ffffff\">\r\n<h1>\r\n學生信息顯示!!!\r\n</h1>\r\n");
// end
// begin [file="/list.jsp";from=(13,2);to=(37,0)]
int intPageSize; //一頁顯示的記錄數
int intRowCount; //記錄總數
int intPageCount; //總頁數
int intPage; //待顯示頁碼
String strPage;
String sql="select * from student";
intPageSize = 2; //設置一頁顯示的記錄數
intRowCount=Common.getResultCount(sql);//記錄總數
intPageCount=(intRowCount+intPageSize-1)/intPageSize;//總頁數
ResultSet rs=Common.executeQuery(sql);
//取得待顯示頁碼
strPage = request.getParameter("page");
if(strPage==null){//表明沒有page參數,顯示第一頁數據
intPage = 1;
}else{
intPage = Integer.parseInt(strPage);//將字符串轉換成整型
if(intPage<1){
intPage = 1;
}else if(intPage>intPageCount){
intPage=intPageCount;
}
}
// end
// HTML // begin [file="/list.jsp";from=(37,2);to=(44,0)]
out.write("\r\n<form method=\"post\" action=\"list.jsp\">\r\n\r\n<table border>\r\n<tr>\r\n <th>編號</th><th>用戶名</th><th>年齡</th><th>來源地</th>\r\n</tr>\r\n");
// end
// begin [file="/list.jsp";from=(44,2);to=(50,0)]
if(intPageCount>0){
rs.absolute((intPage-1) * intPageSize + 1);
//顯示數據
int i = 0;
while(i<intPageSize && !rs.isAfterLast()){
// end
// HTML // begin [file="/list.jsp";from=(50,2);to=(52,6)]
out.write("\r\n<tr>\r\n <td>");
// end
// begin [file="/list.jsp";from=(52,9);to=(52,24)]
out.print(rs.getInt("id"));
// end
// HTML // begin [file="/list.jsp";from=(52,26);to=(53,6)]
out.write("</td>\r\n <td>");
// end
// begin [file="/list.jsp";from=(53,9);to=(53,29)]
out.print(rs.getString("name"));
// end
// HTML // begin [file="/list.jsp";from=(53,31);to=(54,6)]
out.write("</td>\r\n <td>");
// end
// begin [file="/list.jsp";from=(54,9);to=(54,25)]
out.print(rs.getInt("age"));
// end
// HTML // begin [file="/list.jsp";from=(54,27);to=(55,6)]
out.write("</td>\r\n <td>");
// end
// begin [file="/list.jsp";from=(55,9);to=(55,32)]
out.print(rs.getString("address"));
// end
// HTML // begin [file="/list.jsp";from=(55,34);to=(56,29)]
out.write("</td>\r\n <td><a href=\"delete.jsp?id=");
// end
// begin [file="/list.jsp";from=(56,32);to=(56,47)]
out.print(rs.getInt("id"));
// end
// HTML // begin [file="/list.jsp";from=(56,49);to=(58,0)]
out.write("\">刪除 </a></td>\r\n</tr>\r\n");
// end
// begin [file="/list.jsp";from=(58,2);to=(63,0)]
rs.next();
i++;
}
}
// end
// HTML // begin [file="/list.jsp";from=(63,2);to=(66,1)]
out.write("\r\n</table>\r\n\r\n第");
// end
// begin [file="/list.jsp";from=(66,4);to=(66,11)]
out.print(intPage);
// end
// HTML // begin [file="/list.jsp";from=(66,13);to=(66,16)]
out.write("頁 共");
// end
// begin [file="/list.jsp";from=(66,19);to=(66,31)]
out.print(intPageCount);
// end
// HTML // begin [file="/list.jsp";from=(66,33);to=(67,0)]
out.write("頁\r\n");
// end
// begin [file="/list.jsp";from=(67,2);to=(68,0)]
if(intPage>1){
// end
// HTML // begin [file="/list.jsp";from=(68,2);to=(69,24)]
out.write("\r\n <a href=\"list.jsp?page=");
// end
// begin [file="/list.jsp";from=(69,27);to=(69,36)]
out.print(intPage-1);
// end
// HTML // begin [file="/list.jsp";from=(69,38);to=(70,0)]
out.write("\">上一頁</a>\r\n");
// end
// begin [file="/list.jsp";from=(70,2);to=(73,0)]
}
if(intPage<intPageCount){
// end
// HTML // begin [file="/list.jsp";from=(73,2);to=(74,26)]
out.write("\r\n <a href=\"list.jsp?page=");
// end
// begin [file="/list.jsp";from=(74,29);to=(74,38)]
out.print(intPage+1);
// end
// HTML // begin [file="/list.jsp";from=(74,40);to=(75,0)]
out.write("\">下一頁</a>\r\n");
// end
// begin [file="/list.jsp";from=(75,2);to=(77,0)]
}
// end
// HTML // begin [file="/list.jsp";from=(77,2);to=(83,0)]
out.write("\r\n 轉到第:<input type=\"text\" name=\"page\" size=\"2\"> 頁 <input type=\"submit\" value=\"GO\">\r\n</form>\r\n</body>\r\n</center>\r\n</html>\r\n");
// end
} catch (Throwable t) {
if (out != null && out.getBufferSize() != 0)
out.clearBuffer();
if (pageContext != null) pageContext.handlePageException(t);
} finally {
if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext);
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -