<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8" import="java.sql.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<script>
function Confirm() {
s = confirm("后台系统无需使用此方法!")
}
</script>
<body>
<jsp:include page="menu.jsp"></jsp:include>
<jsp:include page="title.jsp"></jsp:include>
<jsp:include page="select.jsp"></jsp:include>
<%
Connection conn=null;
Statement stmt=null;
ResultSet rs=null;
try{
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
String strConn="jdbc:sqlserver://127.0.0.1:1433;DatabaseName=ShopSystem";
String User="sa";
String Password="123456";
conn=DriverManager.getConnection(strConn,User,Password);
String sqlSentence1="Select p_id,p_type,p_name,p_price,p_quantity,p_image from Product Order by p_id desc;";
stmt=conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
rs=stmt.executeQuery(sqlSentence1);
String str=request.getParameter("page");
if(str==null)
str="0";
int pageSize=10;
rs.last();
int recordNum=rs.getRow();
int maxPage=(recordNum%pageSize==0)?(recordNum/pageSize):(recordNum/pageSize+1);
int currentPage=Integer.parseInt(str);
if(currentPage<1)
currentPage=1;
if(currentPage>maxPage)
currentPage=maxPage;
rs.absolute((currentPage-1)*pageSize+1);
%>
<center>
<table style='table-layout: fixed;' width="782" border="1" cellspacing="0" bordercolor="#99CCFF">
<tr>
<th>产品编号</th>
<th>产品类别</th>
<th>产品名称</th>
<th>产品价格</th>
<th>产品数量</th>
<th>产品图片</th>
<th>更新|描述</th>
<th>插入|删除</th>
</tr>
<form action='PREdo_insert.jsp' method="post">
<tr>
<td><input type='text' style='width:95%;height:95%;' name='p_id'/></td>
<td><input type='text' style='width:95%;height:95%;' name='p_type'/></td>
<td><input type='text' style='width:95%;height:95%;' name='p_name'/></td>
<td><input type='text' style='width:95%;height:95%;' name='p_price'/></td>
<td><input type='text' style='width:95%;height:95%;' name='p_quantity'/></td>
<td><input type='text' style='width:95%;height:95%;' name='p_image'/></td>
<td><input type='text' style='width:95%;height:95%;' name='p_description'/></td>
<td><input type='submit' style='width:47.5%;height:47.5%;' value='插入'/>
<input type='reset' style='width:47.5%;height:47.5%;' value='重置'/>
</td>
</tr>
</form>
<%for(int i=1;i<=pageSize;i++){%>
<tr>
<td><input type='text' style='width:95%;height:95%;' value='<%=rs.getString("p_id") %>' readonly="true"/></td>
<td><input type='text' style='width:95%;height:95%;' value='<%=rs.getString("p_type") %>' readonly="true"/></td>
<td><%=rs.getString("p_name") %></td>
<td><%=rs.getString("p_price") %></td>
<td><%=rs.getString("p_quantity") %></td>
<td><img src="../<%=rs.getString("p_image")%>" width="80"></td>
<td><a href="#" onClick="Confirm(); return false;">更改方式1</a>
<br>
<a href="#" onClick="Confirm(); return false;">更改方式2</a>
</td>
<td><a href="query_delete.jsp?id=<%=rs.getString("p_id")%>">删除</a></td>
</tr>
<%
if(!rs.next())
break;
}
%>
<tr>
<td colspan="6" align="center">
<p>JumpTo:<input type="text"name="current"/>
<%if(currentPage>1){%>
<a href="P_Main.jsp?page=1">FirstPage</a>
<a href="P_Main.jsp?page=<%=currentPage-1%>">PreviousPage</a>
<%}%>
||
<%if(currentPage<maxPage){%>
<a href="P_Main.jsp?page=<%=currentPage+1%>">NextPage</a>
<a href="P_Main.jsp?page=<%=maxPage%>">LastPage</a>
<%}%>
</td>
</tr>
</table>
</center>
<%
}catch(Exception e){
out.println(e.getMessage());
}
if(rs!=null)rs.close();
if(stmt!=null)stmt.close();
if(conn!=null)conn.close();
%>
<hr>
<jsp:include page="copyright.jsp"></jsp:include>
</body>
</html>
pageEncoding="UTF-8" import="java.sql.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<script>
function Confirm() {
s = confirm("后台系统无需使用此方法!")
}
</script>
<body>
<jsp:include page="menu.jsp"></jsp:include>
<jsp:include page="title.jsp"></jsp:include>
<jsp:include page="select.jsp"></jsp:include>
<%
Connection conn=null;
Statement stmt=null;
ResultSet rs=null;
try{
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
String strConn="jdbc:sqlserver://127.0.0.1:1433;DatabaseName=ShopSystem";
String User="sa";
String Password="123456";
conn=DriverManager.getConnection(strConn,User,Password);
String sqlSentence1="Select p_id,p_type,p_name,p_price,p_quantity,p_image from Product Order by p_id desc;";
stmt=conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
rs=stmt.executeQuery(sqlSentence1);
String str=request.getParameter("page");
if(str==null)
str="0";
int pageSize=10;
rs.last();
int recordNum=rs.getRow();
int maxPage=(recordNum%pageSize==0)?(recordNum/pageSize):(recordNum/pageSize+1);
int currentPage=Integer.parseInt(str);
if(currentPage<1)
currentPage=1;
if(currentPage>maxPage)
currentPage=maxPage;
rs.absolute((currentPage-1)*pageSize+1);
%>
<center>
<table style='table-layout: fixed;' width="782" border="1" cellspacing="0" bordercolor="#99CCFF">
<tr>
<th>产品编号</th>
<th>产品类别</th>
<th>产品名称</th>
<th>产品价格</th>
<th>产品数量</th>
<th>产品图片</th>
<th>更新|描述</th>
<th>插入|删除</th>
</tr>
<form action='PREdo_insert.jsp' method="post">
<tr>
<td><input type='text' style='width:95%;height:95%;' name='p_id'/></td>
<td><input type='text' style='width:95%;height:95%;' name='p_type'/></td>
<td><input type='text' style='width:95%;height:95%;' name='p_name'/></td>
<td><input type='text' style='width:95%;height:95%;' name='p_price'/></td>
<td><input type='text' style='width:95%;height:95%;' name='p_quantity'/></td>
<td><input type='text' style='width:95%;height:95%;' name='p_image'/></td>
<td><input type='text' style='width:95%;height:95%;' name='p_description'/></td>
<td><input type='submit' style='width:47.5%;height:47.5%;' value='插入'/>
<input type='reset' style='width:47.5%;height:47.5%;' value='重置'/>
</td>
</tr>
</form>
<%for(int i=1;i<=pageSize;i++){%>
<tr>
<td><input type='text' style='width:95%;height:95%;' value='<%=rs.getString("p_id") %>' readonly="true"/></td>
<td><input type='text' style='width:95%;height:95%;' value='<%=rs.getString("p_type") %>' readonly="true"/></td>
<td><%=rs.getString("p_name") %></td>
<td><%=rs.getString("p_price") %></td>
<td><%=rs.getString("p_quantity") %></td>
<td><img src="../<%=rs.getString("p_image")%>" width="80"></td>
<td><a href="#" onClick="Confirm(); return false;">更改方式1</a>
<br>
<a href="#" onClick="Confirm(); return false;">更改方式2</a>
</td>
<td><a href="query_delete.jsp?id=<%=rs.getString("p_id")%>">删除</a></td>
</tr>
<%
if(!rs.next())
break;
}
%>
<tr>
<td colspan="6" align="center">
<p>JumpTo:<input type="text"name="current"/>
<%if(currentPage>1){%>
<a href="P_Main.jsp?page=1">FirstPage</a>
<a href="P_Main.jsp?page=<%=currentPage-1%>">PreviousPage</a>
<%}%>
||
<%if(currentPage<maxPage){%>
<a href="P_Main.jsp?page=<%=currentPage+1%>">NextPage</a>
<a href="P_Main.jsp?page=<%=maxPage%>">LastPage</a>
<%}%>
</td>
</tr>
</table>
</center>
<%
}catch(Exception e){
out.println(e.getMessage());
}
if(rs!=null)rs.close();
if(stmt!=null)stmt.close();
if(conn!=null)conn.close();
%>
<hr>
<jsp:include page="copyright.jsp"></jsp:include>
</body>
</html>









