⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 all_category.jsp

📁 jsp的技术教程
💻 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> -&gt; 商品分类    </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 height="1" bgcolor="" colspan="2">
				<td align="left" colspan="2" height="32">
			<a href="post.jsp">发布书的信息</a>
			</td>
			  </tr>
        </table>                  

<%
//sql1、sql2、sql3分别是用来查询计算机类、英语类、其他类书的数量
String sql1="select * from book where category=1";
String sql2="select * from book where category=2";
String sql3="select * from book where category=3";

//n1、n2、n3分别是用来纪录计算机类、英语类、其他类书的数量
int n1;
int n2;
int n3;
//初始化n1、n2、n3
n1=0;
n2=0;
n3=0;

ResultSet RSsize1 = workM.executeQuery(sql1);
while(RSsize1.next()){
	n1=n1+1;
}

ResultSet RSsize2 = workM.executeQuery(sql2);
while(RSsize2.next()){
	n2=n2+1;
}

ResultSet RSsize3 = workM.executeQuery(sql3);
while(RSsize3.next()){
	n3=n3+1;
}
%>
	商品分类:<br><br>
	<a href="category.jsp?id=1" target="_blank">计算机类[共有<%=n1%>本]</a> |
	<br><br>
    		<a href="category.jsp?id=2"  target="_blank">英语类 [共有<%=n2%>本]</a> |
	<br><br>
			<a href="category.jsp?id=3"  target="_blank">其他类 [共有<%=n3%>本]</a> |
	<br><br>
        </td>
		
    </tr>
	
  </table>
<%@ include file="footer.inc"%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -