?? right2.jsp
字號:
<!-------------------------right begin------------------------------------->
<table width="560" border="0" align="center" cellpadding="0" cellspacing="0" style="margin-bottom: 6">
<!--DWLayoutTable-->
<tr>
<td width="560" height="328" valign="top" bgcolor="#FFFFFF">
<table width="560" height="5" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<!--DWLayoutTable-->
<tr>
<td> <p align="center">
<a target="_blank" href="http://www.jspshop.cn/">
<img src="img/banner.gif" width="575" height="118" border="0"></a></td>
<td width="1"></td>
</tr>
<tr>
<td width=478 height="2" style="border-bottom:#cccccc 1px solid" bgcolor="f7f7f7">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="8%"> </td>
<td height="25" valign="middle"> <b><%=Nsort_name%></b>型號列表 |
<%
sql="select * from Nsort where sort_id="+sort_id+" and Nsort_id<>"+nsort_id;
rs=mdb.executeQuery(sql);
if(rs.next())
{
%>
<font color="#0000FF">相關(guān)小類</font>|--
<%
rs.previous();
while(rs.next())
{
%>
|<a href="nsort.jsp?sort_id=<%=sort_id%>&nsort_id=<%=rs.getInt("Nsort_id")%>"><%=rs.getString("Nsort_name")%></a>
<%
}
}
rs.close();
%>
</td>
</tr>
</table></td>
<td></td>
</tr>
<tr>
<td width="100%"> <table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top"> <div align="center"> </div>
<table width="99%" border="0"cellspacing="0" cellpadding="0" align="center">
<tr>
<td valign="top"> <table width="100%" border="0" cellspacing="0" cellpadding="0" >
<%
int PageSize =10; //設(shè)置每張網(wǎng)頁顯示兩條記錄
int ShowPage = 1; //設(shè)置欲顯示的頁數(shù)
int RowCount = 0; //ResultSet的記錄數(shù)目
int PageCount = 0; //ResultSet分頁后的總頁數(shù)
int duoyu=0;
sql="select * from hw where sort_id="+sort_id+" and Nsort_id="+nsort_id;
rs=mdb.executeQuery(sql);
if(rs.next())
{
//建立ResultSet(結(jié)果集)對象,并執(zhí)行SQL語句
rs.last(); //將指標(biāo)移至最后一筆記錄
RowCount=rs.getRow();
duoyu=RowCount % PageSize;
if(duoyu==0)
{
PageCount=RowCount/PageSize;
}
else{
PageCount=(RowCount-duoyu)/PageSize;
PageCount++;
}
// PageCount=((RowCount % PageSize) == 0?(RowCount/PageSize) : (RowCount/PageSize)+1);
//計算顯示的頁數(shù)
String ToPage = request.getParameter("ToPage");
if(ToPage==""){ToPage="1";}
//判斷是否可正確取得ToPage參數(shù),
//可取得則表示JSP網(wǎng)頁應(yīng)顯示特定分頁記錄的語句
if(ToPage!=""){
ShowPage =Cint(ToPage); //取得指定顯示的分頁頁數(shù)
//下面的if語句將判斷用戶輸入的頁數(shù)是否正確
if(ShowPage > PageCount)
{ //判斷指定頁數(shù)是否大于總頁數(shù), 是則設(shè)置顯示最后一頁
ShowPage = PageCount;
}
else if(ShowPage <= 0)
{ //若指定頁數(shù)小于0, 則設(shè)置顯示第一頁的記錄
ShowPage = 1;
}
}
rs.absolute((ShowPage - 1) * PageSize + 1);
//計算欲顯示頁的第一筆記錄位置
%>
<!----------------------one showing unit------------------------------->
<%
//利用For循環(huán)配合PageSize屬性輸出一頁中的記錄
int i=1,hw_id,daili,pifa,hw_cash,linshi;
String hw_pic,hw_name,hw_content;
rs.previous();
while(rs.next()&i<= PageSize)
{
i++;
hw_id=rs.getInt("hw_id");
hw_pic=rs.getString("hw_pic");
hw_name=rs.getString("hw_name");
hw_content=rs.getString("hw_content");
hw_cash=rs.getInt("hw_cash");
daili=rs.getInt("daili");
pifa=rs.getInt("pifa");
%>
<tr>
<td valign="top"> <table width="100%" border="0" align="center"cellspacing="0">
<tr>
<td width="25%" rowspan="5" bgcolor="#FFFFFF" align="left"><a href="views.jsp?hw_id=<%=hw_id%>"><img border="0" src="<%=hw_pic%>" width="120" height="85"></a>
<div align="right"></div>
<div align="right"></div>
<div align="right"></div></td>
<td height="25" bgcolor="#FFFFFF" width="75%"> </td>
</tr>
<tr>
<td height="28" bgcolor="#FFFFFF" width="75%">
<a href="views.jsp?hw_id=<%=hw_id%>"><font color="#006699"><u><%=hw_name%></u></font></a></td>
</tr>
<tr>
<td height="28" style="line-height:20px" bgcolor="#FFFFFF" width="75%"><%=hw_content%></td>
</tr>
<tr>
<td height="28" bgcolor="#FFFFFF" width="75%">市場價格:<s><%=pifa%></s>元 本站會員價:<%=hw_cash%>元 VIP價:¥<%=daili%>元<br>
<a href='javascript:openbag(<%=hw_id%>)'>定購<img src="img/order.gif" width="21" height="15" border="0" align="middle"></a></td>
</tr>
<tr>
<td height="25" bgcolor="#FFFFFF" width="75%"> </td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="1"></td>
</tr>
</table></td>
</tr>
<%
//下面的if判斷語句用于防止輸出最后一頁記錄時,
//將記錄指標(biāo)移至最后一筆記錄之后
//跳出for循環(huán)
}
%>
<!-----------------------shonwing unit end----------------------------------------------->
</table></td>
</tr>
</table></td>
</tr>
</table></td>
<td></td>
</tr>
<tr>
<td width="100%" height="20"> <div align="center"></div></td>
<td></td>
</tr>
<tr>
<td width=478 height="23"> <p align="right">第<%=ShowPage%>頁/共<%=PageCount%>頁
<%linshi=ShowPage-1;if(linshi>0){%>
<a href="nsort.jsp?sort_id=<%=sort_id%>&ToPage=<%=linshi%>&nsort_id=<%=nsort_id%>">上一頁</a>
<%
}else
{%>
上一頁
<%}%>
<%
linshi=ShowPage+1;
if(linshi<=PageCount){%>
<a href="nsort.jsp?sort_id=<%=sort_id%>&ToPage=<%=linshi%>&nsort_id=<%=nsort_id%>">下一頁</a>
<%
}else
{%>
下一頁
<%}%></font>
</p></td>
<td></td>
</tr>
</table></td>
</tr>
</table>
<!-------------------------right end------------------------------------->
<%
}//找到相應(yīng)的小類的產(chǎn)品
%>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -