J2EE学习笔记——MVC网上商城系统(二)(

本文介绍了一个使用Java和JSP技术实现的商品展示页面案例。页面通过JSP语法动态加载商品列表,并为每个商品提供了查看和删除操作。此外,还提供了修改商品数量的功能。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Result.jsp:

 

<%@ page language="java" import="java.util.*,xuyan.model.*" pageEncoding="gb2312"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
      
   ArrayList al=(ArrayList)request.getAttribute("showresult");
  
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>Result.jsp</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  
  <body>
    
    <form >
    
   
    <div style="text-align: center">
        <div style="text-align: center">
            <table style="width: 578px; height: 76px; background-color: #ffff66;" border="2">
                <tr>
                    <td style="font-weight: bold; width: 100px; color: blue">
                        编号:</td>
                    <td style="font-weight: bold; width: 100px; color: blue">
                        名称:</td>
                    <td style="font-weight: bold; width: 100px; color: blue">
                        单价:</td>
                    <td style="font-weight: bold; width: 100px; color: blue">
                        数量:</td>
                </tr>
                <tr>
                <%
                 
                    for(int i=0;i<al.size();i++)
                    {
                   GoodsBean gb=(GoodsBean)al.get(i);
                        
                    
                   
                 %>
                    <td style="width: 100px; height: 48px;">
                  <%=gb.getGoodsID() %>
                    </td>
                    <td style="width: 100px; height: 48px;">
                  <%=gb.getGoodsName() %>
                    </td>
                    <td style="width: 100px; height: 48px;">
                 <%=gb.getGoodsPrice() %>
                    </td>
                    <td style="width: 100px; height: 48px;">
                        <div style="text-align: center">
                            <table style="width: 144px; height: 28px">
                                <tr>
                                    <td style="width: 63px">
                                       <input type="text" name="num2"></td>
                                    <td style="width: 100px">
                                    <a href="ShopServlet?flag=DeleteGoods">删除</a>
                                       </td>
                                    <td style="width: 100px">
                                         <a href="ShopServlet">查看</a>
                                        </td>
                                </tr>
                            </table>
                        </div>
                        
                       
                    </td>
                </tr>
                <%
                }
                
                 %>
              
                <tr>
                    <td style="width: 100px">
                    </td>
                    <td style="width: 100px">
                        <input  type="button" value="删除全部书籍" /></td>
                    <td style="width: 100px">
                         <input type="submit" value=更改数量></td>
                    <td style="width: 100px">
                    </td>
                </tr>
            </table>
        </div>
    </div>
    
     <div style="text-align: center">
        <table border="2" style="width: 574px; height: 23px">
            <tr>
                <td style="font-weight: bold; width: 100px; color: red">
                                                    您共选择了价值()元的商品
                </td>
                <td style="width: 100px">
                    <input id="Button5" style="width: 101px" type="button" value="下一步" /></td>
            </tr>
        </table>
    </div>
    
    </form>
    
  </body>
</html>


 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值