【JSP开源代码栏目提醒】:网学会员,鉴于大家对JSP开源代码十分关注,论文会员在此为大家搜集整理了“gbook_admin.jsp”一文,供大家参考学习!
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.
sql.*" errorPage="" %>
<%@ include file="../Connections/myeshop.jsp" %>
<%
// *** Restrict Access To Page: Grant or deny access to this page
String MM_authorizedUsers="";
String MM_authFailedURL="gbook_login.jsp";
boolean MM_grantAccess=false;
if (session.getValue("MM_Username") != null && !session.getValue("MM_Username").equals("")) {
if (true || (session.getValue("MM_UserAuthorization")=="") ||
(MM_authorizedUsers.indexOf((String)session.getValue("MM_UserAuthorization")) >=0)) {
MM_grantAccess = true;
}
}
if (!MM_grantAccess) {
String MM_qsChar = "?";
if (MM_authFailedURL.indexOf("?") >= 0) MM_qsChar = "&";
String MM_referrer = request.getRequestURI();
if (request.getQueryString() != null) MM_referrer = MM_referrer + "?" + request.getQueryString();
MM_authFailedURL = MM_authFailedURL + MM_qsChar + "accessdenied=" + java.net.URLEncoder.encode(MM_referrer);
response.sendRedirect(response.encodeRedirectURL(MM_authFailedURL));
return;
}
%>
<%
Driver Driverrecgbook = (Driver)Class.forName(MM_myeshop_DRIVER).newInstance();
Connection Connrecgbook = DriverManager.getConnection(MM_myeshop_STRING,MM_myeshop_USERNAME,MM_myeshop_PASSWORD);
PreparedStatement Statementrecgbook = Connrecgbook.prepareStatement("SELECT * FROM gbooks ORDER BY gbk_date DESC");
ResultSet recgbook = Statementrecgbook.executeQuery();
boolean recgbook_isEmpty = !recgbook.next();
boolean recgbook_hasData = !recgbook_isEmpty;
Object recgbook_data;
int recgbook_numRows = 0;
%>
<%
int Repeat1__numRows = 10;
int Repeat1__index = 0;
recgbook_numRows += Repeat1__numRows;
%>
<%
// *** Recordset Stats, Move To Record, and Go To Record: declare stats variables
int recgbook_first = 1;
int recgbook_last = 1;
int recgbook_total = -1;
if (recgbook_isEmpty) {
recgbook_total = recgbook_first = recgbook_last = 0;
}
//set the number of rows displayed on this page
if (recgbook_numRows == 0) {
recgbook_numRows = 1;
}
%>
<%
// *** Recordset Stats: if we don't know the record count, manually count them
if (recgbook_total == -1) {
// count the total records by iterating through the recordset
for (recgbook_total = 1; recgbook.next(); recgbook_total++);
// reset the cursor to the beginning
recgbook.close();
recgbook = Statementrecgbook.executeQuery();
recgbook_hasData = recgbook.next();
// set the number of rows displayed on this page
if (recgbook_numRows < 0 || recgbook_numRows > recgbook_total) {
recgbook_numRows = recgbook_total;
}
// set the first and last displayed record
recgbook_first = Math.min(recgbook_first, recgbook_total);
recgbook_last = Math.min(recgbook_first + recgbook_numRows - 1, recgbook_total);
}
%>
<% String MM_paramName = ""; %>
<%
// *** Move To Record and Go To Record: declare variables
ResultSet MM_rs = recgbook;
int MM_rsCount = recgbook_total;
int MM_size = recgbook_numRows;
String MM_uniqueCol = "";
MM_paramName = "";
int MM_offset = 0;
boolean MM_atTotal = false;
boolean MM_paramIsDefined = (MM_paramName.length() != 0 && request.getParameter(MM_paramName) != null);
%>
<%
// *** Move To Record: handle 'index' or 'offset' parameter
if (!MM_paramIsDefined && MM_rsCount != 0) {
//use index parameter if defined, otherwise use offset parameter
String r = request.getParameter("index");
if (r==null) r = request.getParameter("offset");
if (r!=null) MM_offset = Integer.parseInt(r);
// if we have a record count, check if we are past the end of the recordset
if (MM_rsCount != -1) {
if (MM_offset >= MM_rsCount || MM_offset == -1) { // past end or move last
if (MM_rsCount % MM_size != 0) // last page not a full repeat region
MM_offset = MM_rsCount - MM_rsCount % MM_size;
else
MM_offset = MM_rsCount - MM_size;
}
}
//move the cursor to the selected record
int i;
for (i=0; recgbook_hasData && (i < MM_offset || MM_offset == -1); i++) {
recgbook_hasData = MM_rs.next();
}
if (!recgbook_hasData) MM_offset = i; // set MM_offset to the last possible record
}
%>
<%
// *** Move To Record: if we dont know the record count, check the display range
if (MM_rsCount == -1) {
// walk to the end of the display range for this page
int i;
for (i=MM_offset; recgbook_hasData && (MM_size < 0 || i < MM_offset + MM_size); i++) {
recgbook_hasData = MM_rs.next();
}
// if we walked off the end of the recordset, set MM_rsCount and MM_size
if (!recgbook_hasData) {
MM_rsCount = i;
if (MM_siz