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

📄 index.jsp

📁 仿照著名的petstore写的网上书店
💻 JSP
字号:
<%-- Copyright 2006 Sun Microsystems, Inc. All rights reserved. You may not modify, use, reproduce, or distribute this software except in compliance with the terms of the License at: http://developer.sun.com/berkeley_license.html$Id: index.jsp,v 1.16 2006/12/13 19:50:46 basler Exp $ --%><%@page contentType="text/html"%><%@page pageEncoding="UTF-8"%><%@page import="java.util.*, com.sun.javaee.blueprints.petstore.model.CatalogFacade, com.sun.javaee.blueprints.petstore.model.Tag"%><%try {    CatalogFacade cf = (CatalogFacade)config.getServletContext().getAttribute("CatalogFacade");    List<Tag> tags=cf.getTagsInChunk(0, 12);    // since top 20 come from database or desending refCount order, need to reorder by tag name    Collections.sort(tags, new Comparator() {        public int compare(Object one, Object two) {             int cc=((Tag)two).getTag().compareTo(((Tag)one).getTag());             return (cc < 0 ? 1 : cc > 0 ? -1 : 0);        }    });    %><html>    <head>        <meta http-equiv="Content-Type" content="text/html;charset=utf-8" >        <title>Books in ForDream</title>        <link type="text/css" rel="stylesheet" href="./tag.css"/>    </head>    <body>                <jsp:include page="banner.jsp" />        <script>            dojo.require("dojo.widget.FisheyeList");            function browse(category) {                window.location.href="${pageContext.request.contextPath}/faces/catalog.jsp?catid=" + category;            }        </script>            <table bgcolor="white">                <tr>                    <td valign="top">                        <div class="outerbar" style="width: 200px">                                                        <div dojoType="FisheyeList"                                 itemWidth="170" itemHeight="50"                                 itemMaxWidth="340" itemMaxHeight="100"                                 orientation="vertical"                                 effectUnits="2"                                 itemPadding="10"                                 attachEdge="top"                                 labelEdge="bottom"                                 enableCrappySvgSupport="false">                                                                <div dojoType="FisheyeListItem" onClick="browse('Science');"                                      iconsrc="${pageContext.request.contextPath}/images/science_icon.JPG">                                </div>                                                                <div dojoType="FisheyeListItem" onClick="browse('Medical');"                                     iconsrc="${pageContext.request.contextPath}/images/medical_icon.jpg">                                </div>                                                                <div dojoType="FisheyeListItem" onClick="browse('History');"                                     iconsrc="${pageContext.request.contextPath}/images/history-icon.jpg">                                </div>                                                                <div dojoType="FisheyeListItem" onClick="browse('Business');"                                     iconsrc="${pageContext.request.contextPath}/images/business_icon.jpg">                                </div>                                                                <div dojoType="FisheyeListItem" onClick="browse('Arts');"                                     iconsrc="${pageContext.request.contextPath}/images/arts-icon.JPG">                                </div>                            </div>                                                    </div>                    </td>                    <td valign="top" style="width: 400px">                        <div id="bodyCenter">                            <table valign="top" id="bodyTable" border="0">                                <tr>                                    <td>                                        <map name="petmap">                                            <area onmouseover="javascript:this.style.cursor='pointer';" onclick="browse('Science')"                                                   alt="SCIENCE"                                                   coords="72,2,280,250">                                            <area onmouseover="javascript:this.style.cursor='pointer';" onclick="browse('Medical')"                                                   alt="MEDICAL"                                                   coords="2,180,72,250">                                            <area onmouseover="javascript:this.style.cursor='pointer';" onclick="browse('History')"                                                   alt="HISTORY"                                                   coords="60,250,130,320">                                            <area onmouseover="javascript:this.style.cursor='pointer';" onclick="browse('Business')"                                                   alt="BUSINESS"                                                   coords="140,270,210,340">                                            <area onmouseover="javascript:this.style.cursor='pointer';" onclick="browse('Arts')"                                                   alt="ARTS"                                                   coords="225,240,295,310">                                            <area onmouseover="javascript:this.style.cursor='pointer';" onclick="browse('Science')"                                                   alt="SCIENCE"                                                   coords="280,180,350,250">                                        </map>                                                                                <img src="${pageContext.request.contextPath}/images/splash.JPG"                                              alt="Books in ForDream"                                             usemap="#petmap"                                              width="350"                                              height="355"                                              border="0">                                    </td>                                </tr>                            </table>                                                    </div>                    </td>                    <td style="vertical-align:top;">                        <div style="border-style: double;;">                            <table>                                <tr>                                    <th colspan="2" style="text-align:center">Most Popular Tags</th>                                </tr>                                <tr><%    String style=null;    int refx=0, ii=0;    for(Tag tag : tags) {        refx=tag.getRefCount() / 5;        if(refx >= 3) {            style="xxlarge";        } else if(refx == 2) {            style="xlarge";        } else if(refx == 1) {            style="large";        } else {            style="medium";        }        if((ii % 2) == 0) out.println("</tr>\n<tr>");        out.println("<td class='tagCell' style='text-align: center'><a href='./tag.jsp?tag=" +             tag.getTag() + "'><span class='" + style +"'>" +  tag.getTag() + "</span></a></td>");        ii++;    }%>                                </tr>                            </table>                        </div>                                                </td>                </tr>            </table>                <div style="position: absolute; visibility: hidden;z-index:5" id="menu-popup">            <table id="completeTable" class="popupTable" ></table>        </div>                <br/><br/>        <jsp:include page="footer.jsp" />            </body></html><%    } catch(Exception e) {        e.printStackTrace();    }%>

⌨️ 快捷键说明

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