<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
<link href="${pageContext.request.contextPath}/static/css/application.css" rel="stylesheet">
<script src="${pageContext.request.contextPath}/static/js/application.js"></script>
<script src="${pageContext.request.contextPath}/static/js/jquery-1.11.0.js"></script>
</head>
<body>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="myTag" tagdir="/WEB-INF/tags" %> <table width="70%" align="center">
<tr>
<td colspan=4><a href="${pageContext.request.contextPath}/toCart">查看购物车</a></td>
</tr>
<c:set var="num" value="0"></c:set>
<c:forEach var="m" items="${page.result}">
<c:if test="${num==0}">
<tr>
</c:if>
<td>
<a href="${pageContext.request.contextPath}/toGoodsDesc/${m.uuid}">
<table>
<tr>
<td><img alt="" src="${pageContext.request.contextPath}/static/images/logo.jpg"/></td>
<td>${m.description }</td>
</tr>
<tr>
<td>${m.name }</td>
</tr>
</table>
</a>
</td>
<c:set var="num" value="${num+1}"></c:set>
<c:if test="${num==3}">
<c:set var="num" value="0"></c:set>
</tr>
</c:if>
</c:forEach>
</table> </body>
</html>

关于Goods的控制器

package com.sishuok.architecture1.goodsmgr.web;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam; import com.sishuok.architecture1.goodsmgr.service.IGoodsService;
import com.sishuok.architecture1.goodsmgr.vo.GoodsModel;
import com.sishuok.architecture1.goodsmgr.vo.GoodsQueryModel;
import com.sishuok.pageutil.Page;
import com.sishuok.util.format.DateFormatHelper;
import com.sishuok.util.json.JsonHelper; @Controller
@RequestMapping(value="/goods")
public class GoodsController {
@Autowired
private IGoodsService iservice = null; @RequestMapping(value="toAdd",method=RequestMethod.GET)
public String toAdd(){ return "goods/add";
}
@RequestMapping(value="add",method=RequestMethod.POST)
public String add(@ModelAttribute("m") GoodsModel m){
iservice.create(m);
return "goods/success";
}
@RequestMapping(value="toUpdate/{uuid}",method=RequestMethod.GET)
public String toUpdate(Model model,@PathVariable("uuid") int uuid){
GoodsModel m = iservice.getByUuid(uuid);
model.addAttribute("m", m);
return "goods/update";
}
@RequestMapping(value="update",method=RequestMethod.POST)
public String post(@ModelAttribute("m") GoodsModel m){
iservice.update(m);
return "goods/success";
}
@RequestMapping(value="toDelete/{uuid}",method=RequestMethod.GET)
public String toDelete(Model model,@PathVariable("uuid") int uuid){
GoodsModel m = iservice.getByUuid(uuid);
model.addAttribute("m", m);
return "goods/delete";
}
@RequestMapping(value="delete",method=RequestMethod.POST)
public String post(@RequestParam("uuid") int uuid){
iservice.delete(uuid);
return "goods/success";
}
@RequestMapping(value="toList",method=RequestMethod.GET)
public String toList(@ModelAttribute("wm")GoodsWebModel wm,Model model){
GoodsQueryModel qm = null;
if(wm.getQueryJsonStr()==null || wm.getQueryJsonStr().trim().length()==0){
qm = new GoodsQueryModel();
}else{
String s = wm.getQueryJsonStr();
s = s.replace("-", "%");
qm = (GoodsQueryModel)JsonHelper.str2Object(s, GoodsQueryModel.class);
} qm.getPage().setNowPage(wm.getNowPage());
if(wm.getPageShow() > 0){
qm.getPage().setPageShow(wm.getPageShow());
} Page dbPage = iservice.getByConditionPage(qm); //
model.addAttribute("wm", wm);
model.addAttribute("page", dbPage); return "goods/list";
}
@RequestMapping(value="toQuery",method=RequestMethod.GET)
public String toQuery(){
return "goods/query";
}
}

  

 

Java高级架构师(一)第28节:Index、商品详细页和购物车的更多相关文章

  1. Java高级架构师(一)第01节:整体课程概览

    本课程专注于构建:高可扩展性.高性能.大数据量.高并发.分布式的系统架构. 从零开始.全面系统.成体系的软件架构课程,循序渐进的讲述构建上述系统架构所需要的各种技术知识和技能. 适应人群: 1:有一定 ...

  2. 好好讲一讲,到底什么是Java高级架构师!

    一. 什么是架构师 曾经有这么个段子: 甲:我已经应聘到一家中型软件公司了,今天上班的时候,全公司的人都来欢迎我. 乙:羡慕ing,都什么人来了? 甲:CEO.COO.CTO.All of 程序员,还 ...

  3. JAVA高级架构师基础功:Spring中AOP的两种代理方式:动态代理和CGLIB详解

    在spring框架中使用了两种代理方式: 1.JDK自带的动态代理. 2.Spring框架自己提供的CGLIB的方式. 这两种也是Spring框架核心AOP的基础. 在详细讲解上述提到的动态代理和CG ...

  4. 图灵,咕泡,鲁班学院--Java高级架构师-互联网企业级实战VIP课程(价值6380)

    课程介绍:        讲课内容涉及Java互联网技术工程框架.应用框架.        性能调优 (Tomcat Nginx JVM)         分布式框架(并发编程 Zookeeper N ...

  5. Java高级架构师(一)第42节:应用上Nginx过后的体系结构

    以后的架构思考方向: 体系结构的演变

  6. Java高级架构师(一)第31节:Nginx简介、安装和基本运行

    第一节:主要介绍Nginx和安装

  7. Java高级架构师(一)第26节:测试并调整登录的业务功能

    主Index的处理Java: package com.sishuok.architecture1; import org.springframework.beans.factory.annotatio ...

  8. Java高级架构师(一)第25节:实现前端的业务登录等功能

    package com.sishuok.architecture1; import javax.servlet.http.Cookie; import javax.servlet.http.HttpS ...

  9. Java高级架构师(一)第19节:X-gen生成相应的Visitor

    package cn.javass.themes.smvcsm.visitors; import cn.javass.xgen.genconf.vo.ExtendConfModel; import c ...

随机推荐

  1. Eclipse CDT 调用printf/cout 控制台(console)无输出

    转摘自:http://blog.csdn.net/dj0379/article/details/6940836 症状描述: 用Eclipse调试程序,执行printf和cout函数,但是console ...

  2. im4java学习----查看文档和test用例

    im4java下载地址:http://sourceforge.net/projects/im4java/files/(谷歌搜索出来的第一个官方地址打不开) 我们需要下载bin和src 这2个压缩包. ...

  3. webpack 的第三方库分离并持久化缓存

    我们常常需要在浏览器缓存一些稳定的资源,如第三方库等.要达到这个目标,只需要两步: 1.提取出“稳定的资源”: 2.提供稳定的文件hash . 处理后的出的文件就像这样子: app.1w3ad4q4. ...

  4. 转:深入理解javascript原型和闭包系列

    转自:深入理解javascript原型和闭包系列 从下面目录中可以看到,本系列有16篇文章,外加两篇后补的,一共18篇文章.写了半个月,从9月17号开始写的.每篇文章更新时,读者的反馈还是可以的,虽然 ...

  5. HDU1847 Good Luck in CET-4 Everybody!

    大学英语四级考试就要来临了,你是不是在紧张的复习?也许紧张得连短学期的ACM都没工夫练习了,反正我知道的Kiki和Cici都是如此.当然,作为在 考场浸润了十几载的当代大学生,Kiki和Cici更懂得 ...

  6. python configparse

    # 参考:https://www.cnblogs.com/lily1989/p/8401005.html # https://blog.csdn.net/willhuo/article/details ...

  7. Linux下git源码安装【转】

    转自:http://blog.csdn.net/u012889638/article/details/51167123 版权声明:本文为博主原创文章,未经博主允许不得转载. 版本信息:CentOS r ...

  8. Appium===Appium+Python API(转)

    Appium+python自动化8-Appium Python API 前言: Appium Python API全集,不知道哪个大神整理的,这里贴出来分享给大家. 1.contexts contex ...

  9. Java易错知识点(1) - 关于ArrayList移除元素后剩下的元素会立即重排

    帮一个网友解答问题时,发现这样一个易错知识点,现总结如下: 1.易错点: ArrayList移除元素后,剩下的元素会立即重排,他的 size() 也会立即减小,在循环过程中容易出错.(拓展:延伸到所有 ...

  10. springboot 整合springDataJPA

    springboot 整合springDataJPA 〇.搭建springboot环境 一.添加依赖 mysql <!-- mysql驱动 --> <dependency> & ...