其他分享
首页 > 其他分享> > 传智书城代码

传智书城代码

作者:互联网

index.jsp源代码,如下

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <title>传智书城</title>
    <%-- 导入css --%>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/client/css/main.css" type="text/css" />
    <!-- 导入首页轮播图css和js脚本 -->
    <link type="text/css" href="${pageContext.request.contextPath }/client/css/autoplay.css" rel="stylesheet" />
    <script type="text/javascript" src="${pageContext.request.contextPath }/client/js/autoplay.js"></script>
</head>

<body class="main">
    <%@include file="head.jsp"%>
    <%@include file="menu_search.jsp" %>
    <%-- <div id="divad">
        <img src="${pageContext.request.contextPath}/client/ad/index_ad.jpg"/>
    </div> --%>
    
    <!-- 图书商场首页轮播图  start -->
    <div id="box_autoplay">
        <div class="list">
            <ul>
                <li><img src="${pageContext.request.contextPath }/client/ad/index_ad1.jpg" width="900" height="335" /></li>
                <li><img src="${pageContext.request.contextPath }/client/ad/index_ad2.jpg" width="900" height="335" /></li>
                <li><img src="${pageContext.request.contextPath }/client/ad/index_ad3.jpg" width="900" height="335" /></li>
                <li><img src="${pageContext.request.contextPath }/client/ad/index_ad4.jpg" width="900" height="335" /></li>
                <li><img src="${pageContext.request.contextPath }/client/ad/index_ad5.jpg" width="900" height="335" /></li>
            </ul>
        </div>
    </div>
    <!-- 图书商场首页轮播图  end -->    
    <div id="divcontent">
        <table width="900px" border="0" cellspacing="0">
            <tr>
                <td width="497">
                    <img src="${pageContext.request.contextPath}/client/images/billboard.gif" width="497" height="38" />
                    <table cellspacing="0" class="ctl">
                        <tr>
                            <td width="485" height="100%">${n.details }</td>
                        </tr>
                    </table>
                </td>
                <td style="padding:5px 15px 10px 40px">
                    <table width="100%" border="0" cellspacing="0">
                        <tr>
                            <td>
                                <img src="${pageContext.request.contextPath}/client/images/hottitle.gif" width="126" height="29" />
                            </td>
                        </tr>
                    </table>
                    <table width="100%" border="0" cellspacing="0">
                        <tr>
                        <c:forEach items="${pList }" var="pArray">
                            <td style="width:80; text-align:center">
                                <a href="${pageContext.request.contextPath}/findProductById?id=${pArray[0]}">
                                    <img src="${pageContext.request.contextPath }${pArray[2]}" width="102" height="130" border="0" />
                                </a>
                                <br/>
                                <a href="${pageContext.request.contextPath}/findProductById?id=${pArray[0]}">${pArray[1]}</a>
                          
                            </td>
                        </c:forEach>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
    </div>
    <%@ include file="foot.jsp" %>
</body>
</html>

head.jsp源代码如下

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="cn.itcast.itcaststore.domain.User"%>
<script type="text/javascript">
//退出确认框
function confirm_logout() {   
    var msg = "您确定要退出登录吗?";   
    if (confirm(msg)==true){   
    return true;   
    }else{   
    return false;   
    }   
}
</script>
<div id="divhead">
    <table cellspacing="0" class="headtable">
        <tr>
            <td>
                <a href="${pageContext.request.contextPath }/index.jsp">
                    <img src="${pageContext.request.contextPath}/client/images/logo.png" width="200" height="60" border="0" />
                </a>
            </td>
            <td style="text-align:right">
                <img src="${pageContext.request.contextPath}/client/images/cart.gif" width="26" height="23" style="margin-bottom:-4px" />
                   &nbsp;
                  <a href="${pageContext.request.contextPath}/client/cart.jsp">购物车</a>
                | <a href="#">帮助中心</a>
                | <a href="${pageContext.request.contextPath}/myAccount">我的帐户</a>
                <%
                User user = (User) request.getSession().getAttribute("user");
                if(null == user){
                %>
                | <a href="${pageContext.request.contextPath}/client/register.jsp">新用户注册</a>                            
                <%     
                }else{
                %>
                | <a href="${pageContext.request.contextPath}/logout" οnclick="javascript:return confirm_logout()">用户退出</a>
                <br><br><br>欢迎您: ${user.username}
                <%     
                }
                %>            
            </td>        
        </tr>
    </table>
</div>

 

foot.jsp代码如下

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<div id="divfoot">
    <table width="100%" border="0" cellspacing="0">
        <tr>
            <td rowspan="2" style="width:10%">
                <img src="${pageContext.request.contextPath}/client/images/logo.png" width="100" height="40"
                style="margin-left:175px" />
            </td>
            <td style="padding-top:5px; padding-left:20px">
                <a href="#">
                    <font color="#747556"><b>CONTACT US</b></font>
                </a>
            </td>
        </tr>
        <tr>
            <td style="padding-left:20px">
                <font color="#CCCCCC">
                    <b>COPYRIGHT 2016 &copy; ItcastStore All Rights RESERVED.</b>
                </font>
            </td>
        </tr>
    </table>
</div>

标签:confirm,代码,jsp,user,传智,源代码,书城,User
来源: https://blog.csdn.net/UNDEFIN123456/article/details/118961416