📄 warelist_jsp.java
字号:
package org.apache.jsp;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import java.util.*;
import com.mybusiness.web.ware.wareclass;
import com.mybusiness.web.ware.ware;
public final class warelist_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent {
private static java.util.Vector _jspx_dependants;
public java.util.List getDependants() {
return _jspx_dependants;
}
public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
JspFactory _jspxFactory = null;
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page = this;
JspWriter _jspx_out = null;
PageContext _jspx_page_context = null;
try {
_jspxFactory = JspFactory.getDefaultFactory();
response.setContentType("text/html; charset=gb2312");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
com.mybusiness.web.ware.ware book = null;
synchronized (_jspx_page_context) {
book = (com.mybusiness.web.ware.ware) _jspx_page_context.getAttribute("book", PageContext.PAGE_SCOPE);
if (book == null){
book = new com.mybusiness.web.ware.ware();
_jspx_page_context.setAttribute("book", book, PageContext.PAGE_SCOPE);
}
}
out.write('\r');
out.write('\n');
com.mybusiness.web.waremn book_list = null;
synchronized (_jspx_page_context) {
book_list = (com.mybusiness.web.waremn) _jspx_page_context.getAttribute("book_list", PageContext.PAGE_SCOPE);
if (book_list == null){
book_list = new com.mybusiness.web.waremn();
_jspx_page_context.setAttribute("book_list", book_list, PageContext.PAGE_SCOPE);
}
}
out.write('\r');
out.write('\n');
com.mybusiness.web.wareclasslist classlist = null;
synchronized (_jspx_page_context) {
classlist = (com.mybusiness.web.wareclasslist) _jspx_page_context.getAttribute("classlist", PageContext.PAGE_SCOPE);
if (classlist == null){
classlist = new com.mybusiness.web.wareclasslist();
_jspx_page_context.setAttribute("classlist", classlist, PageContext.PAGE_SCOPE);
}
}
out.write('\r');
out.write('\n');
int pages=1;
String mesg = "";
if (request.getParameter("page")!=null && !request.getParameter("page").equals("")) {
String requestpage = request.getParameter("page");
try {
pages = Integer.parseInt(requestpage);
} catch(Exception e) {
mesg = "你要找的页码错误!";
}
book_list.setPage(pages);
}
String classid = request.getParameter("classid");
String classname ="";
String keyword = request.getParameter("keyword");
if (classid==null) classid="";
if (keyword==null) keyword="";
keyword = book_list.getGbk(keyword);
out.write("\r\n");
out.write("\r\n");
out.write("<html>\r\n");
out.write("<head>\r\n");
out.write("<title>商场翱游购物系统 选购商品</title>\r\n");
out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\">\r\n");
out.write("<script language=\"javascript\">\r\n");
out.write("\r\n");
out.write("function openScript(url,name, width, height){\r\n");
out.write("\tvar Win = window.open(url,name,'width=' + width + ',height=' + height + ',resizable=1,scrollbars=yes,menubar=no,status=yes' );\r\n");
out.write("}\r\n");
out.write("\r\n");
out.write("</script>\r\n");
out.write("<link rel=\"stylesheet\" href=\"ware.css\" type=\"text/css\">\r\n");
out.write("</head>\r\n");
out.write("\r\n");
out.write("<body background=images/112.gif text=\"#000000\">\r\n");
out.write("<div align=\"center\">\r\n");
out.write(" <table width=\"750\" border=\"0\" cellspacing=\"1\" cellpadding=\"1\">\r\n");
out.write(" <tr> \r\n");
out.write(" <td align=\"center\"><img src=\"images/baners2.gif\" width=\"670\" height=\"120\"></td>\r\n");
out.write(" <br>\r\n");
out.write(" </td>\r\n");
out.write(" </tr>\r\n");
out.write(" </table>\r\n");
out.write("\r\n");
out.write(" <table width=\"750\" border=\"0\" cellspacing=\"1\" cellpadding=\"1\">\r\n");
out.write(" <tr> \r\n");
out.write(" <td width=\"200\"> </td>\r\n");
out.write(" <td width=\"55\"><a href=\"index.jsp\">首页</a></td>\r\n");
out.write(" <td width=\"100\"><a href=\"warelist.jsp\">在线购物</a></td>\r\n");
out.write(" <td width=\"100\"><a href=\"shoperlist.jsp\">我的购物车</a></td>\r\n");
out.write(" <td width=\"100\"><a href=\"userinfo.jsp\">用户信息</a></td>\r\n");
out.write(" <td><a href=\"login.jsp\">用户登录</a></td>\r\n");
out.write(" </tr>\r\n");
out.write(" </table>\r\n");
out.write(" <table width=\"750\" border=\"0\" cellspacing=\"1\" cellpadding=\"1\">\r\n");
out.write(" <tr valign=\"top\"> \r\n");
out.write(" <td width=\"186\"> \r\n");
out.write(" <table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"1\">\r\n");
out.write(" <tr> \r\n");
out.write(" <td width=\"20\"> </td>\r\n");
out.write(" <td>本店商品分类:</td>\r\n");
out.write(" </tr>\r\n");
out.write(" ");
if (classlist.excute()){
for (int i=0;i<classlist.getClasslist().size();i++){
wareclass bc = (wareclass) classlist.getClasslist().elementAt(i);
if ( classid.equals(Integer.toString(bc.getId())) ) classname=bc.getClassName();
out.write("\r\n");
out.write(" <tr> \r\n");
out.write(" <td width=\"20\"> </td>\r\n");
out.write(" <td><a href=\"warelist.jsp?classid=");
out.print( bc.getId());
out.write('"');
out.write('>');
out.print( bc.getClassName() );
out.write("</a></td>\r\n");
out.write(" </tr>\r\n");
out.write(" ");
}
}
out.write("\r\n");
out.write(" <tr> \r\n");
out.write(" <td width=\"20\"> </td>\r\n");
out.write(" <td> </td>\r\n");
out.write(" </tr>\r\n");
out.write(" </table>\r\n");
out.write("\t\t<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"1\">\r\n");
out.write("\t\t <FORM name=form1 METHOD=POST ACTION=\"warelist.jsp\">\r\n");
out.write(" <tr> \r\n");
out.write(" <td align=center><b>商品查询:</b></td>\r\n");
out.write(" </tr>\r\n");
out.write("\t\t <tr> \r\n");
out.write(" <td>关键字:<INPUT TYPE=\"text\" NAME=\"keyword\" size=8 maxlength=40 value=\"");
out.print( keyword );
out.write("\"></td>\r\n");
out.write(" </tr>\r\n");
out.write(" <tr>\r\n");
out.write("\t\t <td>类别:\r\n");
out.write("\t\t <SELECT NAME=\"classid\">\r\n");
out.write("\t\t\t\t<option value=\"\">所有类别</option>\t\t\t\r\n");
out.write("\t\t \r\n");
out.write("\t\t ");
for (int i=0;i<classlist.getClasslist().size();i++){
wareclass bc = (wareclass) classlist.getClasslist().elementAt(i);
out.write("\t\t \r\n");
out.write(" <option value=\"");
out.print( bc.getId());
out.write('"');
out.write('>');
out.print( bc.getClassName() );
out.write("</option>\r\n");
out.write(" ");
}
out.write("</SELECT>\r\n");
out.write("\t\t </td>\r\n");
out.write(" </tr>\r\n");
out.write(" <tr> \r\n");
out.write(" <td align=\"center\"><INPUT TYPE=\"submit\" name=\"submit\" value=\"查询\" ></td>\r\n");
out.write(" </tr>\t\t \r\n");
out.write("\t\t </FORM>\r\n");
out.write(" </table>\r\n");
out.write(" <p><img src=\"images/qrjbutton.gif\" width=\"120\" height=\"120\"></p>\r\n");
out.write(" </td>\r\n");
out.write(" <td align=\"center\"> \r\n");
out.write(" <p><br>\r\n");
out.write(" <b><font color=\"#0000FF\">电子商务商品");
out.print( classname );
out.write("列表</font></b></p>\r\n");
out.write("\t\t ");
if (!keyword.equals("")) out.println("<p ><font color=#ff0000>你要查找关于 " + keyword + " 的商品如下</font></p>");
out.write("\r\n");
out.write(" <table width=\"100%\" border=\"1\" cellspacing=\"1\" cellpadding=\"1\" bordercolor=\"#CC9966\">\r\n");
out.write(" <tr align=\"center\"> \r\n");
out.write(" <td>商品名称</td>\r\n");
out.write(" <td>商品类别</td>\r\n");
out.write(" <td>生产商</td>\r\n");
out.write(" <td>单价</td>\r\n");
out.write(" <td width=110>选择</td>\r\n");
out.write(" </tr>\r\n");
if (book_list.execute(request)) {
if (book_list.getBooklist().size()>0 ){
for (int i=0;i<book_list.getBooklist().size();i++){
ware bk = (ware) book_list.getBooklist().elementAt(i);
out.write("\r\n");
out.write(" <tr>\r\n");
out.write(" <td>");
out.print( bk.getBookName() );
out.write("</td>\r\n");
out.write(" <td align=\"center\">");
out.print( bk.getClassname() );
out.write("</td>\r\n");
out.write(" <td align=\"center\">");
out.print( bk.getPublish() );
out.write("</td>\r\n");
out.write(" <td align=\"center\">");
out.print( bk.getPrince() );
out.write("元</td>\r\n");
out.write(" <td align=\"center\"><a href=\"#\" onclick=\"openScript('purchase.jsp?bookid=");
out.print( bk.getId() );
out.write("','pur',300,250)\" >购买</a> \r\n");
out.write("\t\t\t<a href=\"#\" onclick=\"openScript('showware.jsp?bookid=");
out.print( bk.getId() );
out.write("','show',400,450)\" >详细资料</a></td>\r\n");
out.write(" </tr>\r\n");
}
}else {
if (keyword.equals("")){
out.println("<tr><td align='center' colspan=6> 暂时没有此类商品资料</td></tr>");
} else {
out.println("<tr><td align='center' colspan=6> 没有你要查找的 " + keyword + " 相关商品</td></tr>") ;
}
}
} else {
out.write("\r\n");
out.write(" <tr> \r\n");
out.write(" <td align=\"center\" colspan=6> 数据库出错,请稍后</td>\r\n");
out.write(" \r\n");
out.write(" </tr>\r\n");
}
out.write("\r\n");
out.write("\r\n");
out.write(" </table>\r\n");
out.write(" <table width=\"90%\" border=\"0\" cellspacing=\"1\" cellpadding=\"1\">\r\n");
out.write(" <tr>\r\n");
out.write(" <td align=\"right\">总计结果为");
out.print( book_list.getRecordCount() );
out.write("条,当前页第");
out.print( book_list.getPage() );
out.write("页 <a href=\"warelist.jsp?classid=");
out.print( classid);
out.write("&keyword=");
out.print( keyword );
out.write("\">首页</a> \r\n");
out.write(" ");
if (book_list.getPage()>1) {
out.write("\r\n");
out.write(" <a href=\"warelist.jsp?page=");
out.print( book_list.getPage()-1 );
out.write("&classid=");
out.print( classid);
out.write("&keyword=");
out.print( keyword );
out.write("\">上一页</a> \r\n");
out.write(" ");
}
out.write("\r\n");
out.write(" ");
if (book_list.getPage()<book_list.getPageCount()-1) {
out.write("\r\n");
out.write(" <a href=\"warelist.jsp?page=");
out.print( book_list.getPage()+1 );
out.write("&classid=");
out.print( classid);
out.write("&keyword=");
out.print( keyword );
out.write("\">下一页</a> \r\n");
out.write(" ");
}
out.write("\r\n");
out.write(" <a href=\"warelist.jsp?page=");
out.print( book_list.getPageCount() );
out.write("&classid=");
out.print( classid);
out.write("&keyword=");
out.print( keyword );
out.write("\">未页</a> </td>\r\n");
out.write(" </tr>\r\n");
out.write(" </table>\r\n");
out.write(" </td>\r\n");
out.write(" </tr>\r\n");
out.write(" </table>\r\n");
out.write(" <table width=\"70%\" border=\"0\" cellspacing=\"2\" cellpadding=\"2\">\r\n");
out.write(" <tr>\r\n");
out.write(" <td align=\"center\">开发:王文耀<br>\r\n");
out.write(" CopyRight@2006 <br>\r\n");
out.write(" Email:<a href=\"mailto:wwy170@163.com\">wwy170@163.com</a></td>\r\n");
out.write(" </tr>\r\n");
out.write(" </table>\r\n");
out.write(" \r\n");
out.write("</div>\r\n");
out.write("</body>\r\n");
out.write("</html>\r\n");
book_list.close();
} catch (Throwable t) {
if (!(t instanceof SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
out.clearBuffer();
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
}
} finally {
if (_jspxFactory != null) _jspxFactory.releasePageContext(_jspx_page_context);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -