JavaWeb-21 (MVC购物车2)

一.login 登录
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
 
</head>
<body>
 
<!-- 显示数据时,判断非空 -->
    <c:if test="${empty listGoods }">
        <jsp:forward page="load.do"></jsp:forward>
    </c:if>
 
    <h1 style="text-align: center;">我的购物商城首页</h1>
    <div style="text-align: center;">
         <form action="load.do" method="post">
              名称<input type="text" name="strName">
              <input type="submit" value ="搜索">
         </form>
    </div>
 
    <table border="1" width="70%" align = "center">
        <tr>
            <th>编号</th>
            <th>名称</th>
            <th>价格</th>
            <th>操作</th>
        </tr>
        
        <c:forEach items="${listGoods }" var="goods">
        
        <tr>
            <td>${goods.gid}</td>
            <td>${goods.gname}</td>
            <td>${goods.gprice}</td>
            <td>
                <button οnclick="addCart(${goods.gid})">加入购物车</button>
            </td>
        </tr>
</c:forEach>
        
    </table>
    
    <div style="text-align: center;">
      [${pageIndex }/${pageMax }]
      <a href="load.do?pageIndex=1">首页</a>
      <a href="load.do?pageIndex=${pageIndex-1<0?1:pageIndex-1 }">上一页</a>
      <a href="load.do?pageIndex=${pageIndex+1>pageMax?pageMax:pageIndex+1 }&strName=${strName}">下一页</a>
      <a href="load.do?pageIndex=${pageMax }">尾页</a>
    </div>
    
    
    <script type="text/javascript">
    //加入购物车的点击事件
    function addCart(cid){
        //alert(cid)
        location.href = "/shopping.do?cid="+cid;
    }
 
</script>
    
</body>
</html>

二.register 注册
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<!-- <link type="text/css" rel="stylesheet" href="css/style2.css" /> -->
<style type="text/css">
body { margin:0; padding:0; font-size:12px; line-height:20px; font-family:宋体; }
.wrap { margin:0 auto; width:960px; }
h2,h4,p,form,input,ul,li,dl,dt,dd { margin:0; padding:0; }
table { border-collapse:collapse; }
ul { list-style:none; }
a:link, a:visited { color:#039; text-decoration:none; }
a:hover, a:active { color:#03F; text-decoration:underline; }
/* clearFix */
.clearfix:after{content:".";display:block;height:0;clear:both;visibility:hidden}
.clearfix{ display:block; display:inline-block; }
 
.success { background:url(images/success_ico.gif) 20px 20px no-repeat; }
.success .information { margin-left:180px; }
 
#header { }
#header #logo { background:url(images/logo.jpg); width:263px; height:56px; text-indent:-1000em; }
#header #navbar { color:#fff; background:#fc883b; padding:2px; line-height:25px; text-align:right; }
#header .userMenu { float:left; }
#header .userMenu ul li { float:left; margin:0px 2px; display:inline; }
#header .userMenu ul li a { display:block; padding:0px 15px; text-decoration:none; background:#ffe0a3; white-space:nowrap; }
#header .userMenu ul li.current a { font-weight:bold; background:#fff; }
#header #navbar input { margin-right:5px; vertical-align:middle; border:1px solid #ccc; }
#header #navbar input.input-text { padding:2px 3px; width:120px; height:16px; }
#header #navbar input.input-btn { border:none; background:url(images/button_search.gif); height:22px; width:46px; }
 
#footer { border-top:2px solid #ccc; line-height:40px; text-align:center; }
 
#login { border:1px solid #666; margin:80px auto; padding:4px; width:360px; }
#login h2 { font-size:14px; line-height:30p

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值