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

📄 search_jsp.java

📁 项目名称eShop
💻 JAVA
字号:
package org.apache.jsp;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import java.text.*;
import java.util.*;
import eshop.business.*;
import eshop.common.*;

public final class search_jsp extends org.apache.jasper.runtime.HttpJspBase
    implements org.apache.jasper.runtime.JspSourceDependent {

  private static java.util.List _jspx_dependants;

  public Object 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,
      			"", 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("<html>\r\n");
      out.write("<head>\r\n");
      out.write("<link rel=stylesheet href=\"css/style.css\" type=\"text/css\"> \r\n");
      out.write("<meta http-equiv=\"content-type\" content=\"text/html; charset=gb2312\">\r\n");
      out.write("<script language=\"JavaScript\" src=\"js/controller.js\"></script>\r\n");
      out.write("<script language=\"JavaScript\" src=\"js/imageControl.js\"></script>\r\n");
      out.write("</head>\r\n");
      out.write("<body>\r\n");
      out.write("\r\n");

     String strUserCode=session.getAttribute("s_UserCode")==null?"":(String)session.getAttribute("s_UserCode");


      out.write("\r\n");
      out.write("<table cellspacing=\"0\" cellpadding=\"0\" width=\"800\">\r\n");
      out.write("  <tr height=\"80\">\r\n");
      out.write("     <td width=\"20\"></td>\r\n");
      out.write("     <td width=\"200\"><img src=\"image/Logo.png\"></td>\r\n");
      out.write("     <td width=\"200\">\r\n");
      out.write("        <table>\r\n");
      out.write("           <tr height=\"20\"></tr>\r\n");
      out.write("           <tr height=\"30\">\r\n");
      out.write("             ");

                 if(strUserCode.equals(""))
                  {
                     out.print("<td width=90>[<a class=nav2 href=login.htm target=_blank >登录</a>]</td>");
                     out.print("<td width=20></td>");
                     out.print("<td width=90>[<a class=nav2 href=reg.htm target=_blank>注册</a>]</td>");
                  }  
                 else
                  {
                     out.print("<td width=90>[<a class=nav2 href=myaccount.htm target=_blank >"+strUserCode+"</a></td>");
                     out.print("<td width=20></td>");
                     out.print("<td width=90><a class=nav2 href=QuiteAction>安全退出</a>]</td>");
                  }
             
      out.write("              \r\n");
      out.write("            \r\n");
      out.write("           </tr>\r\n");
      out.write("           <tr height=\"30\"></tr>\r\n");
      out.write("        </table>\r\n");
      out.write("     </td>\r\n");
      out.write("     <td width=\"200\"></td>\r\n");
      out.write("     <td width=\"150\">\r\n");
      out.write("        <table cellspacing=\"0\" cellpadding=\"0\" >\r\n");
      out.write("           <tr height=\"40\"></tr>\r\n");
      out.write("           <tr height=\"19\">\r\n");
      out.write("              <td width=\"4\"><img src=\"image/es_top_001.gif\"></td>\r\n");
      out.write("              <!--尽量使用单引号',否则jsp引擎转换成servlet时可能会出错-->\r\n");
      out.write("              <td width='60' background='image/es_top_002.gif'><img src='image/es_top_cart.gif'>  <a href='cart.jsp' target='_blank' title='购物车'>购物车</a></td>\r\n");
      out.write("              <td width=\"4\"><img src=\"image/es_top_003.gif\"></td>\r\n");
      out.write("              <td width=\"10\"></td>\r\n");
      out.write("              <td width=\"4\"><img src=\"image/es_top_001.gif\"></td>\r\n");
      out.write("              <td width=\"60\" background=\"image/es_top_002.gif\"><center><a href='myaccount.htm' target='_blank' title=\"我的帐户\">我的帐户</a></center></td>\r\n");
      out.write("              <td width=\"4\"><img src=\"image/es_top_003.gif\"></td>\r\n");
      out.write("           </tr>\r\n");
      out.write("           <tr height=\"21\"></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 cellspacing=\"0\" cellpadding=\"0\" width=\"800\">\r\n");
      out.write("   <tr>\r\n");
      out.write("     <td width=\"60\"></td>\r\n");
      out.write("     <td width=\"60\" class=tag><a href=\"index.htm\" target=_blank>首页<a></td>\r\n");
      out.write("     <td width=\"1\"></td>\r\n");
      out.write("     <td width=\"60\" class=tag><a href=\"\">热门商品<a></td> \r\n");
      out.write("     <td width=\"1\"></td>\r\n");
      out.write("     <td width=\"60\" class=tag><a href=\"\">商品分类<a></td> \r\n");
      out.write("     <td width=\"558\"></td>\r\n");
      out.write("   </tr>\r\n");
      out.write("</table>\r\n");
      out.write("\r\n");
      out.write("<table cellspacing=\"0\" cellpadding=\"0\" width=\"800\">\r\n");
      out.write("<form name=searchForm action=\"search.jsp\" method=\"post\">\r\n");
      out.write("   <tr height=\"35\">\r\n");
      out.write("     <td width=\"11\"><img src=\"image/es_top_004.gif\"></td>\r\n");
      out.write("     <td width=\"779\" background=\"image/es_top_005.gif\">\r\n");
      out.write("        <table cellspacing=\"0\" cellpadding=\"0\" width=\"779\">\r\n");
      out.write("           <tr>\r\n");
      out.write("             <td width=\"50\"></td>\r\n");
      out.write("             <td width=\"60\">\r\n");
      out.write("               <select name=\"type\" width=\"60\">\r\n");
      out.write("                  <option value=\"0\">所有商品    </option>\r\n");
      out.write("                  <option value=\"1\">按书名搜索  </option>\r\n");
      out.write("                  <option value=\"2\">按作者搜索  </option>\r\n");
      out.write("               </select>\r\n");
      out.write("             </td>\r\n");
      out.write("             <td width=\"10\"></td>\r\n");
      out.write("             <td width=\"60\"><input type=\"text\" name=\"keyword\" size=\"10\"></td> \r\n");
      out.write("             <td width=\"20\"></td>\r\n");
      out.write("             <td width=\"60\"><input type=\"submit\" name=\"search\" value=\"搜索\"></td>\r\n");
      out.write("             <td width=\"519\"></td>\r\n");
      out.write("           </tr>\r\n");
      out.write("        </table> \r\n");
      out.write("     </td>\r\n");
      out.write("     <td width=\"10\"><img src=\"image/es_top_006.gif\"></td>\r\n");
      out.write("   </tr>\r\n");
      out.write("</form>\r\n");
      out.write("</table> \r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");

   /***********************************************************************
    *
    *                        显示搜索结果
    *
   ************************************************************************/



      out.write('\r');
      out.write('\n');

      String strType=request.getParameter("type");
      if(strType==null)
        {
           strType="0";
        }
      if(strType.equals(""))
        {
           strType="0";
        }
      ISearchBook search=SearchBookFactory.getInstance(strType);
      
      String strKeyword=request.getParameter("keyword");
      if(strKeyword==null)
        {
           strKeyword="";
        }  
      Collection clnBooks=search.getBook(strKeyword);
      Iterator itBook=clnBooks.iterator();
     
 
      out.write("\r\n");
      out.write("\r\n");
      out.write("<br>\r\n");
      out.write("\r\n");
      out.write("<!--表头Start-->\r\n");
      out.write("<table cellspacing=\"0\" cellpadding=\"0\" width=\"98\" >\r\n");
      out.write("  <tr height=\"22\">\r\n");
      out.write("    <!-- <td width=\"11\"><img src=\"image/es_top_004.gif\"</td>-->\r\n");
      out.write("    <td width=\"98\" align=\"center\"  background=\"image/es_booklist_001.gif\" class=\"font-title1\">\r\n");
      out.write("        图书列表\r\n");
      out.write("    </td>\r\n");
      out.write("    <!--<td width=\"10\"><img src=\"image/es_top_006.gif\"</td>-->\r\n");
      out.write("  </tr>  \r\n");
      out.write("</table>\r\n");
      out.write("<!--表头End-->\r\n");
      out.write("<table cellspacing=\"0\" cellpadding=\"0\" width=\"480\">\r\n");
      out.write(" <tr height=\"8\">\r\n");
      out.write("    <td width=\"480\" style=\"background-color:#ffcc99\"></td>\r\n");
      out.write(" </tr> \r\n");
      out.write("  <tr height=\"30\">\r\n");
      out.write("    <td width=\"480\" style=\"background-color:#F5F5F5;padding-right:10px\" align=\"right\"></td>\r\n");
      out.write(" </tr> \r\n");
      out.write("</table>\r\n");
      out.write("<!--图书列表Start-->\r\n");
      out.write("<table cellspacing=\"0\" cellpadding=\"0\" width=\"480\" class=tableBorder1>\r\n");

BookVO book=null;
while(itBook.hasNext())
 {
     book=(BookVO)itBook.next();

      out.write("\r\n");
      out.write("<!--第1行Start-->\r\n");
      out.write("<tr>\r\n");
      out.write("  <td width=\"100\">\r\n");
      out.write("    <!--<img src=\"UploadBookPicture/es_200606111430032_pm.jpg\" onload=\"javascript:DrawImage(this);\">-->\r\n");
      out.write("       ");
String strImg=book.getBookPicture();
          if(strImg==null||strImg.equals(""))
           {
              strImg="default.gif";
           }
       
      out.write("\r\n");
      out.write("       <img src=\"UploadBookPicture/");
      out.print(strImg);
      out.write("\" onload=\"javascript:DrawImage(this);\">\r\n");
      out.write("      \r\n");
      out.write("  </td>\r\n");
      out.write("  <td>\r\n");
      out.write("    <table cellspacing=\"0\" cellpadding=\"0\" width=\"220\" class=tableBorder1>\r\n");
      out.write("      <tr>\r\n");
      out.write("        <td><a class=\"font-book\" href=\"bookdetail.jsp?bookid=");
      out.print(book.getBookID());
      out.write('"');
      out.write('>');
      out.print(book.getBookName());
      out.write("</a></td>\r\n");
      out.write("      </tr>\r\n");
      out.write("    </table>\r\n");
      out.write("  </td>\r\n");
      out.write("  <td width=\"220\">\r\n");
      out.write("    <table cellspacing=\"0\" cellpadding=\"0\" width=\"160\" class=tableBorder1>\r\n");
      out.write("      <tr>\r\n");
      out.write("        <td class=\"font-orange\">商城价:");
      out.print(book.getBookEshopPrice());
      out.write("</td>\r\n");
      out.write("      </tr>\r\n");
      out.write("      <tr>\r\n");
      out.write("        <td class=\"font-linethrough1\">市场价:");
      out.print(book.getBookPrice());
      out.write("</td>\r\n");
      out.write("      </tr>\r\n");
      out.write("      <tr>\r\n");
      out.write("        <td><input type=\"button\" name=\"btnBuy\" class=\"btnBuy\" value=\"购买\" onClick='return goCart(");
      out.print(book.getBookID());
      out.write(");'></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("<tr class=\"dot-line\" width=\"480\">\r\n");
      out.write("  <th colspan=\"3\"></th>\r\n");
      out.write("</tr>\r\n");

}

      out.write("\r\n");
      out.write("<!--第1行End-->\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("</table>\r\n");
      out.write("<!--图书列表End-->\r\n");
      out.write("<table cellspacing=\"0\" cellpadding=\"0\" width=\"480\" >\r\n");
      out.write("  <tr height=\"30\">\r\n");
      out.write("    <td width=\"480\" style=\"background-color:#F5F5F5;padding-right:10px\" align=\"right\"></td>\r\n");
      out.write(" </tr> \r\n");
      out.write("</table>\r\n");
      out.write("\r\n");
      out.write("</body>\r\n");
    } 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 + -