在线搜索
来源:互联网 发布:sql删除表中带约束的列 编辑:程序博客网 时间:2024/04/18 17:04
在这个jsp页直接去调用。ConnectionDB类,从而去数据库去查找。并显示在页面中!
<%@ page language="java" import="java.util.*,javabean.*" pageEncoding="UTF-8"%>
<center><%@ include file="top.html"%></center>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>搜索的商品有如下:</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body><br>
<CENTER><FONT color=red size=4>搜索的商品有如下:</font></CENTER>
<table border=1 cellspacing=0 bgcolor="#ffccff" align=center width=80%>
<tr>
<TD align=center>商品编号</TD><TD align=center>商品名称</TD><TD align=center>商品类型</TD>
<TD align=center>商品单价</TD><TD align=center>我要买</TD>
</tr>
<%
request.setCharacterEncoding("gb2312");
response.setContentType("text/html;charset=gb2312");
ConnectionDB con = new ConnectionDB();
Vector v=(Vector)session.getAttribute("v");
if(v.size()==0){
out.println("<br><br><center>");
out.println("<h1> <font color='red'> 对不起!没有找到您所需要的商品!</font></h1>");
out.println("<A href='jsp/Checkout.jsp'>返回购物主页</A>");
out.println("<br><br></center>");
out.close();
}
Iterator it=v.iterator();
Goods goods=null;
while(it.hasNext()){
goods=(Goods)it.next();
%>
<tr>
<TD align=center><%=goods.getId()%></TD>
<TD align=center><%=goods.getName()%></TD>
<TD align=center><%=goods.getType()%></TD>
<TD align=center><%=goods.getPrice()%></TD>
<TD align=center><form action="jsp/goods_show.jsp" method=post>
<input type=hidden name=id value=<%=goods.getId()%>>
<input type=hidden name=name value=<%=goods.getName()%>>
<input type=hidden name=type value=<%=goods.getType()%>>
<input type=hidden name=price value=<%=goods.getPrice()%>>
<input type=submit value="购买">
</form>
</TD>
</tr>
<%}%>
</table> <br>
<CENTER>
<A href="jsp/Checkout.jsp">返回购物主页</A>
</CENTER>
</body>
</html>
<%@ page language="java" import="java.util.*,javabean.*" pageEncoding="UTF-8"%>
<center><%@ include file="top.html"%></center>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>搜索的商品有如下:</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body><br>
<CENTER><FONT color=red size=4>搜索的商品有如下:</font></CENTER>
<table border=1 cellspacing=0 bgcolor="#ffccff" align=center width=80%>
<tr>
<TD align=center>商品编号</TD><TD align=center>商品名称</TD><TD align=center>商品类型</TD>
<TD align=center>商品单价</TD><TD align=center>我要买</TD>
</tr>
<%
request.setCharacterEncoding("gb2312");
response.setContentType("text/html;charset=gb2312");
ConnectionDB con = new ConnectionDB();
Vector v=(Vector)session.getAttribute("v");
if(v.size()==0){
out.println("<br><br><center>");
out.println("<h1> <font color='red'> 对不起!没有找到您所需要的商品!</font></h1>");
out.println("<A href='jsp/Checkout.jsp'>返回购物主页</A>");
out.println("<br><br></center>");
out.close();
}
Iterator it=v.iterator();
Goods goods=null;
while(it.hasNext()){
goods=(Goods)it.next();
%>
<tr>
<TD align=center><%=goods.getId()%></TD>
<TD align=center><%=goods.getName()%></TD>
<TD align=center><%=goods.getType()%></TD>
<TD align=center><%=goods.getPrice()%></TD>
<TD align=center><form action="jsp/goods_show.jsp" method=post>
<input type=hidden name=id value=<%=goods.getId()%>>
<input type=hidden name=name value=<%=goods.getName()%>>
<input type=hidden name=type value=<%=goods.getType()%>>
<input type=hidden name=price value=<%=goods.getPrice()%>>
<input type=submit value="购买">
</form>
</TD>
</tr>
<%}%>
</table> <br>
<CENTER>
<A href="jsp/Checkout.jsp">返回购物主页</A>
</CENTER>
</body>
</html>
- 在线搜索
- MP3在线搜索下载程序
- Google搜索在线摄像头监视站点
- PHP开发入门-在线图片搜索
- Android -- 在线播放歌曲 1 -- 搜索歌曲
- SearchAnywhere®网站在线搜索、光盘搜索、局域网内搜索以及应用搜索
- 在线图像搜索应该得到操作系统的支持
- 案例1—MP3在线搜索下载程序
- 搜索某个网段内所有在线IP的一串命令
- 有用的图标搜索网址和在线制作图标网址
- 视频种子搜索神器【可以迅雷云播放,在线观看】
- 排列搜索-c#求解-英雄会在线编程题目
- iOS百度地图在线建议api做搜索区域推荐
- 中关村在线ZOL搜索页面:找出值得抓取的host
- iOS--在线搜索苹果 App Store 应用商店
- 在线搜索添加Jar(第三方库)组件"坐标"
- 在线搜索添加maven的jar组件坐标
- ios百度地图地址搜索功能-在线建议查询
- 购物车
- 新的开始?!
- 4月4日,安全评价软件的安装
- 一个Win32 C++ 动态连接库的模板 --- 调用方可管理DLL分配的内存
- Java: 第一次尝试Java,Thread类
- 在线搜索
- GPGPU::数学基础教程
- OpenGL自动为每个顶点分配坐标
- 落雪木马病毒的手工清除方法
- 线性插值
- OpenGL Performance Optimization
- JAVA 常用知识
- Trees in SQL
- 关于LINUX起动时在sendmail处等待时间过长的解决方法