首页上一页 1 下一页尾页 3 条记录 1/1页
只要运行都会显示出错
发表在其他语言图书答疑区
2014-12-16
是否精华
是
否
版块置顶:
是
否
不知道是不是代码出错了啊。我是直接从光盘里拷贝过去的啊.
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" %>
<%@ page import="com.bwm.db.Condb"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>首页</title>
<link href="css/style.css" rel="stylesheet">
</head>
<script language="javascript">
<!--
function check(){
if(form3.shop.value==""){
alert("请输入搜索的商品名称");
return false;
form2.shop.focus();
history.back();
}
}
-->
</script>
<script src="js/DateTime2.js" language="javascript">
</script>
<body>
<%@ include file="top.jsp"%>
<table width="800" height="431" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#FCBE3F" bordercolordark="#FCBE3F" bordercolorlight="#FFFFFF">
<tr>
<td width="174" height="429" valign="top" background="images/images/top_12.gif">
<%@ include file="left.jsp"%> </td>
<td width="626" valign="top">
<table width="101%" border="0" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF" bordercolorlight="#FCBE3F" bordercolordark="#FFFFFF" background="images/images/top_7.gif">
<tr>
<form name="form3" method="post" action="forward.jsp">
<td width="65%" height="28" align="center" valign="middle">商品搜索:
<select name="wtype" class="wenbenkuang">
<option>体育用品</option>
<option>生活用品</option>
<option>电脑科技</option>
<option>装饰艺术</option>
<option>其它</option>
</select>
<input name="shop" type="text" class="txt_grey">
<input name="Submit" type="submit" class="btn_grey" value="搜索" onClick="return check()">
<input name="Submit2" type="reset" class="btn_grey" value="重置"></td>
</form>
<td width="35%" align="center" valign="middle" class="bgcolor" id="time"><script>ShowTime(time);</script></td>
</tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0" background="images/images/top_13.gif">
<%
/*****下面主要是想利session对象来判断用户是否是第一次登录******/
/*if(session.isNew()){
out.println("<script language='javascript'>alert('欢迎您首次光临本网站');</script>");
}
/*****下面主要是想利application对象来判断用户登录的次数******/
/*int cou=0;
if(application.getAttribute("counter")==null){
application.setAttribute("counter","0");
out.println("<script language='javascript'>alert('您是第一位访问者');</script>");
}else{
cou=Integer.parseInt(application.getAttribute("counter").toString());
cou++;
out.println("<script language'javascript'>alert('这个页面已经被访问"+cou+"次了');</script>");
application.setAttribute("counter",new Integer(cou));//这段是把最后访问的次数保存起来了,下次在访问的时候把这个值取出来
}*/
String sql="select * from tb_Ware order by Dattime";
ResultSet rs=con.executeQuery(sql);
int num=0;
int count=0;
int i=1;
while(rs.next()){
count++;
if(count==9){
break;
}
String warename=rs.getString(2);
String wareprice=rs.getString(3);
String wareintro=rs.getString(5);
String img=rs.getString(6);
if(i%2!=0){
%>
<tr>
<td width="164" height="141" valign="top"><img src="<%=img%>" width="162" height="130" border="1"></td>
<td width="148" align="center" valign="top"> <table width="100%" height="132" border="0" cellpadding="0" cellspacing="0" >
<tr>
<td width="49" height="32" align="left"> 名称:</td>
<td width="95" align="left"><%=warename%></td>
</tr>
<tr>
<td height="32"> 价格:</td>
<td height="32"><%=wareprice%></td>
</tr>
<tr>
<td height="32"> 介绍:
</td>
<td height="32"><%=wareintro%></td>
</tr>
<tr>
<td height="32" colspan="2"><center>
<a href="user/look.jsp?buy1=<%=warename%>"><img src="images/buy.GIF" width="45" height="20" class="btn_grey"></a>
</center></td>
</tr>
</table>
</td>
<%
}else{
%>
<td width="164" align="center" valign="top"><img src="<%=img%>" width="162" height="130" border="1"></td>
<td width="149" align="center" valign="top"><table width="105%" height="132" cellpadding="0" cellspacing="0" >
<tr>
<td width="47" height="36"> 名称:</td>
<td width="91"><%=warename%></td>
</tr>
<tr>
<td height="29"> 价格:</td>
<td height="29"><%=wareprice%></td>
</tr>
<tr>
<td height="28"> 介绍:</span></td>
<td height="28"><%=wareintro%></td>
</tr>
<tr>
<td height="36" colspan="2" class="style2"><center>
<a href="user/look.jsp?buy1=<%=warename%>"><img src="images/buy.GIF" width="45" height="20" class="btn_grey"></a>
</center></td>
</tr>
</table></td>
</tr>
<%
}
i++;
}con.close();
%>
<tr align="right">
<td colspan="4"><a href="middle.jsp">更多....</a></td>
</tr>
</table>
</td>
</tr>
</table>
<%@ include file="copy.jsp"%>
</body>
</html>
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" %>
<%@ page import="com.bwm.db.Condb"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>首页</title>
<link href="css/style.css" rel="stylesheet">
</head>
<script language="javascript">
<!--
function check(){
if(form3.shop.value==""){
alert("请输入搜索的商品名称");
return false;
form2.shop.focus();
history.back();
}
}
-->
</script>
<script src="js/DateTime2.js" language="javascript">
</script>
<body>
<%@ include file="top.jsp"%>
<table width="800" height="431" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#FCBE3F" bordercolordark="#FCBE3F" bordercolorlight="#FFFFFF">
<tr>
<td width="174" height="429" valign="top" background="images/images/top_12.gif">
<%@ include file="left.jsp"%> </td>
<td width="626" valign="top">
<table width="101%" border="0" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF" bordercolorlight="#FCBE3F" bordercolordark="#FFFFFF" background="images/images/top_7.gif">
<tr>
<form name="form3" method="post" action="forward.jsp">
<td width="65%" height="28" align="center" valign="middle">商品搜索:
<select name="wtype" class="wenbenkuang">
<option>体育用品</option>
<option>生活用品</option>
<option>电脑科技</option>
<option>装饰艺术</option>
<option>其它</option>
</select>
<input name="shop" type="text" class="txt_grey">
<input name="Submit" type="submit" class="btn_grey" value="搜索" onClick="return check()">
<input name="Submit2" type="reset" class="btn_grey" value="重置"></td>
</form>
<td width="35%" align="center" valign="middle" class="bgcolor" id="time"><script>ShowTime(time);</script></td>
</tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0" background="images/images/top_13.gif">
<%
/*****下面主要是想利session对象来判断用户是否是第一次登录******/
/*if(session.isNew()){
out.println("<script language='javascript'>alert('欢迎您首次光临本网站');</script>");
}
/*****下面主要是想利application对象来判断用户登录的次数******/
/*int cou=0;
if(application.getAttribute("counter")==null){
application.setAttribute("counter","0");
out.println("<script language='javascript'>alert('您是第一位访问者');</script>");
}else{
cou=Integer.parseInt(application.getAttribute("counter").toString());
cou++;
out.println("<script language'javascript'>alert('这个页面已经被访问"+cou+"次了');</script>");
application.setAttribute("counter",new Integer(cou));//这段是把最后访问的次数保存起来了,下次在访问的时候把这个值取出来
}*/
String sql="select * from tb_Ware order by Dattime";
ResultSet rs=con.executeQuery(sql);
int num=0;
int count=0;
int i=1;
while(rs.next()){
count++;
if(count==9){
break;
}
String warename=rs.getString(2);
String wareprice=rs.getString(3);
String wareintro=rs.getString(5);
String img=rs.getString(6);
if(i%2!=0){
%>
<tr>
<td width="164" height="141" valign="top"><img src="<%=img%>" width="162" height="130" border="1"></td>
<td width="148" align="center" valign="top"> <table width="100%" height="132" border="0" cellpadding="0" cellspacing="0" >
<tr>
<td width="49" height="32" align="left"> 名称:</td>
<td width="95" align="left"><%=warename%></td>
</tr>
<tr>
<td height="32"> 价格:</td>
<td height="32"><%=wareprice%></td>
</tr>
<tr>
<td height="32"> 介绍:
</td>
<td height="32"><%=wareintro%></td>
</tr>
<tr>
<td height="32" colspan="2"><center>
<a href="user/look.jsp?buy1=<%=warename%>"><img src="images/buy.GIF" width="45" height="20" class="btn_grey"></a>
</center></td>
</tr>
</table>
</td>
<%
}else{
%>
<td width="164" align="center" valign="top"><img src="<%=img%>" width="162" height="130" border="1"></td>
<td width="149" align="center" valign="top"><table width="105%" height="132" cellpadding="0" cellspacing="0" >
<tr>
<td width="47" height="36"> 名称:</td>
<td width="91"><%=warename%></td>
</tr>
<tr>
<td height="29"> 价格:</td>
<td height="29"><%=wareprice%></td>
</tr>
<tr>
<td height="28"> 介绍:</span></td>
<td height="28"><%=wareintro%></td>
</tr>
<tr>
<td height="36" colspan="2" class="style2"><center>
<a href="user/look.jsp?buy1=<%=warename%>"><img src="images/buy.GIF" width="45" height="20" class="btn_grey"></a>
</center></td>
</tr>
</table></td>
</tr>
<%
}
i++;
}con.close();
%>
<tr align="right">
<td colspan="4"><a href="middle.jsp">更多....</a></td>
</tr>
</table>
</td>
</tr>
</table>
<%@ include file="copy.jsp"%>
</body>
</html>