📄 short_goods.jsp
字号:
<%@ include file="head.inc"%>
<%@ page language="java" import="java.sql.*" %>
<jsp:useBean id="workM" scope="page" class="test.faq" />
<jsp:useBean id='clock' scope='page' class='dates.JspCalendar' type="dates.JspCalendar" />
<%!
public String getStr(String str)
{
try
{
String temp_p=str;
byte[] temp_t=temp_p.getBytes("GBK");
String temp=new String(temp_t,"ISO8859_1");
return temp;
}
catch(Exception e)
{
}
return "null";
}
%>
<%!
public static String category(int id)
{
try
{
switch(id)
{
case 1:
return "计算机类";
//break;
case 2:
return "英语类";
//break;
default:
return "其他类";
//break;
}
}
catch(Exception e)
{
}
return "null";
}
%>
<TABLE border=0 cellPadding=0 cellSpacing=0 width=760 align="center">
<TBODY>
<tr><td align="left" height=25><%if(session.getAttribute("username")!=null){out.println(session.getAttribute("username"));}%> 当前位置:<a href="../index.jsp">首页</a> -> 缺货登记 </td>
<%@ include file="../member/date.inc"%>
</tr>
<TR bgColor=#3399ff>
<TD height=1 colspan="2"><IMG height=1 src="images/spacer.gif"
width=16></TD></TR>
<tr><td height=10 colspan="2"><IMG height=1 src="images/spacer.gif"
width=16></td></tr>
</TBODY></TABLE>
<table align="center" border="0" width="760" cellspacing="0" cellpadding="0" height="355">
<tr>
<td width="150" height="355" valign="top">
</td>
<td width="10" height="100%"></td>
<td width="1" height="100%" bgcolor="#3399ff"></td>
<td width="10" height="100%"></td>
<td width="589" height="331" valign="top" background="images/bg1.gif">
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="62%" height="20" bgcolor="#3399ff"> <font color="#ffffff">标题</font>
</td>
<td width="15%" height="20" bgcolor="#3399ff"> <font color="#ffffff">作者</font>
</td>
<td width="15%" height="20" bgcolor="#3399ff"> <font color="#ffffff">类别</font>
</td>
<td width="8%" height="20" bgcolor="#3399ff"> <font color="#ffffff">缺货</font>
</td>
</tr>
<ul>
<%///////////////算出共多少页
int t;
int mtotal;
t=0;
String strSQLsize="SELECT id FROM book where book_number<=0";
ResultSet RSsize = workM.executeQuery(strSQLsize);
while(RSsize.next()){
t=t+1;
}
//out.println(t/3);
//out.println(t%3>0);
//如果纪录总数除以每页的显示个数,余数大于0,那么
//逻辑页数应该为商+1
if((t%3)>0){
mtotal=t/3+1;
}else mtotal=t/3;
// out.println(mtotal);
%>
<%!String pageNo, mTmp;
int i, j, k;
%>
<%
pageNo = request.getParameter("pageNo");
//out.println(pageNo);=========null
if(pageNo == null){
pageNo = "1";
}
j = Integer.parseInt(pageNo);
// out.println(pageNo);=========1
// out.println(j);==========1
if(j < 1)
j = 1;
if(j > mtotal)
j = mtotal;
//out.println(j);
%>
<%
String strSQL="SELECT * FROM book where book_number<=0 order by id desc";
ResultSet RSa = workM.executeQuery(strSQL);
for(k = 0;k < (j-1)*3;k++)
{ //out.println(RSa.next());
RSa.next();
}
i = 0;
k = 1;
while (RSa.next()) {
//out.println("ok"+i+"ok");
i = i + 1;
//超过3条
if(i == 4)
{
k = 0;
break;
}
out.print("<tr height='23'><td><li><a href=javascript:show('book.jsp?id="+RSa.getInt("id")+"','详细资料',480,500)");
out.print(">"+getStr(RSa.getString("name"))+"</a></td><td>"+getStr(RSa.getString("author"))+"</td><td>"+(category(RSa.getInt("category")))+"</td><td>缺货</td></tr>");
}
i = i - k;
//out.println("i de zhi::"+i);
RSa.close();
%>
<%////////////////////////////////////////////////
if(j > 1)
{
%>
<a href="short_goods.jsp?pageNo=1">第一页</a>
<%
int ii = Integer.parseInt(pageNo,10);
// out.println(ii);
if(ii > 1)
ii = ii -1;
String ssTmp = Integer.toString(ii);
%>
<a href="short_goods.jsp?pageNo=<%=ssTmp%>">上一页</a>
<%
}
if(j < mtotal)
{
int ii = Integer.parseInt(pageNo,10);
if(ii < mtotal)
ii = ii + 1;
String ssTmp = Integer.toString(ii);
%>
<a href="short_goods.jsp?pageNo=<%=ssTmp%>">下一页</a>
<a href="short_goods.jsp?pageNo=<%=mtotal%>">最后页</a>
<%
}
if(mtotal < j)
j = mtotal;
%>
<%////////////////////////////////////////////%>
<tr><td height="1" bgcolor="" colspan="2">
<hr color="#3399ff">
结果共<%=mtotal%>页,显示第<%=j%>页</td>
<td align="left" colspan="2" height="32">
<a href="post.jsp">发布书的信息</a>
</td>
</tr>
</table>
</form>
商品分类:<a href="category.jsp?id=1">计算机类</a> |
<a href="category.jsp?id=2">英语类 </a> |
<a href="category.jsp?id=3">其他类 </a> |
</td>
</tr>
</table>
<%@ include file="footer.inc"%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -