?? showmerchant.jsp
字號:
<%@ page contentType="text/html; charset=gb2312" language="java" %>
<%@ page import="java.sql.*,com.netshop.*" %>
<jsp:useBean scope="page" id="goods" class="com.netshop.goods" />
<jsp:useBean scope="page" id="executeWay" class="com.netshop.executeWay" />
<%
request.setCharacterEncoding("gb2312");
int count=0;
int totalPageCount=0;
int perPageCount=5;
int currentPage=1;
String pageId = request.getParameter("page");
if(pageId!=null)
{
currentPage=Integer.parseInt(pageId);
}
String shopName = request.getParameter("shopName");
String shopper = request.getParameter("shopper");
String strMainFields = request.getParameter("mainFields");
long mainFields = 0;
String strField = "";
if(strMainFields != null)
{
mainFields = Long.parseLong(strMainFields);
}
if(mainFields > 0)
{
strField = " and mainFields ="+mainFields;
}
if(shopName == null)
{
shopName = "";
}
shopName = shopName.trim();
if(shopper == null)
{
shopper = "";
}
shopper = shopper.trim();
String strSql= "select * from users where sysRole=2 and tag != -1 and shopName like '%"+shopName+"%' and shopper like '%"+shopper+"%'"+strField;
%>
<html>
<head>
<title>網上商品交易平臺</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language=javascript>
function submitForm(subPage)
{
document.all.page=subPage;
document.all.form1.action="showMerchant.jsp";
document.all.form1.submit();
}
</script>
</head>
<body>
<div align=center>
<p align="center"><font size="5">店鋪信息</font></p>
<table width="90%" border=0>
<tr bgcolor="#F0F0F0">
<td align="center"><font size="4">店名</font></td>
<td align="center"><font size="4">店主</font></td>
<td align="center"><font size="4">經營項目</font></td>
<td align="center"><font size="4">店鋪介紹</font></td>
</tr>
<%
ResultSet rs = executeWay.exeSqlQuery(strSql);
rs.last();//移到末尾
count = rs.getRow();//取得總查詢數
totalPageCount = (count + perPageCount -1)/perPageCount;
if(currentPage > totalPageCount || currentPage<=0)
{
currentPage=1;
}
int currentIndex = (currentPage - 1) * perPageCount +1;
if(count>0)
{
rs.absolute(currentIndex);
String strSql1 = "select name from goodsField where ID = '"+rs.getLong("mainFields")+"'";
ResultSet rs1 = executeWay.exeSqlQuery(strSql1);
rs1.first();
%>
<tr>
<td>
<a href=shopShow.jsp?ID=<%=rs.getLong("ID")%> target=_blank>
<%=rs.getString("shopName")%>
</a></td>
<td> <%=rs.getString("shopper")%></td>
<td> <%=rs1.getString("name")%></td>
<td> <%=rs.getString("shopIntro")%></td>
</tr>
<%
int i=1;
while(rs.next())
{
strSql1 = "select name from goodsField where ID = '"+rs.getLong("mainFields")+"'";
rs1 = executeWay.exeSqlQuery(strSql1);
rs1.first();
%>
<tr>
<td>
<a href=shopShow.jsp?ID=<%=rs.getLong("ID")%> target=_blank>
<%=rs.getString("shopName")%>
</a></td>
<td> <%=rs.getString("shopper")%></td>
<td> <%=rs1.getString("name")%></td>
<td> <%=rs.getString("shopIntro")%></td>
</tr>
<%
i++;
if(i > perPageCount-1) break;
}
}
%>
</table>
<br>
<table width="90%" border=0>
<form name="form1" method="post" id="form1">
<input type="hidden" name="shopName" id="shopName" value="<%=shopName%>">
<input type="hidden" name="mainFields" id="mainFields" value="<%=strMainFields%>">
<input type="hidden" name="shopper" id="shopper" value="<%=shopper%>">
<input type="hidden" name="page" id="page">
<TR height="20">
<TD width="25%" height="20" align="center" valign="top">
共<font color="#0000FF"><%= count %></font>條
第<font color="#0000FF"><%= currentPage %></font>頁/共
<font color="#0000FF"><%= totalPageCount %></font>頁
</TD>
<TD width="10%" height="20" align="center" valign="top">
<input type="submit" name="sub1" value="首頁" onclick="submitForm(1)">
</form>
</TD>
<TD width="10%" height="20" align="center" valign="top">
<input type="submit" name="sub2" value="上一頁" onclick="submitForm(<%=currentPage-1%>)">
</TD>
<TD width="10%" height="20" align="center" valign="top">
<input type="submit" name="sub3" value="下一頁" onclick="submitForm(<%=currentPage+1%>)">
</form>
</TD >
<TD width="10%" height="20" align="center" valign="top">
<input type="submit" name="sub4" value="尾頁" onclick=submitForm(<%= totalPageCount%>)>
</TD>
<TD width="20%" height="20" valign="top" align="center">
到第<input type="text" name="page1" size="3">頁 <input type="submit" name="sub5" value="GO" onclick="submitForm(document.all.page1.value)">
</TD>
</TR>
</form>
</table>
</div>
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -