Java高级架构师(一)第28节:Index、商品详细页和购物车
<%@ 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、商品详细页和购物车的更多相关文章
- Java高级架构师(一)第01节:整体课程概览
本课程专注于构建:高可扩展性.高性能.大数据量.高并发.分布式的系统架构. 从零开始.全面系统.成体系的软件架构课程,循序渐进的讲述构建上述系统架构所需要的各种技术知识和技能. 适应人群: 1:有一定 ...
- 好好讲一讲,到底什么是Java高级架构师!
一. 什么是架构师 曾经有这么个段子: 甲:我已经应聘到一家中型软件公司了,今天上班的时候,全公司的人都来欢迎我. 乙:羡慕ing,都什么人来了? 甲:CEO.COO.CTO.All of 程序员,还 ...
- JAVA高级架构师基础功:Spring中AOP的两种代理方式:动态代理和CGLIB详解
在spring框架中使用了两种代理方式: 1.JDK自带的动态代理. 2.Spring框架自己提供的CGLIB的方式. 这两种也是Spring框架核心AOP的基础. 在详细讲解上述提到的动态代理和CG ...
- 图灵,咕泡,鲁班学院--Java高级架构师-互联网企业级实战VIP课程(价值6380)
课程介绍: 讲课内容涉及Java互联网技术工程框架.应用框架. 性能调优 (Tomcat Nginx JVM) 分布式框架(并发编程 Zookeeper N ...
- Java高级架构师(一)第42节:应用上Nginx过后的体系结构
以后的架构思考方向: 体系结构的演变
- Java高级架构师(一)第31节:Nginx简介、安装和基本运行
第一节:主要介绍Nginx和安装
- Java高级架构师(一)第26节:测试并调整登录的业务功能
主Index的处理Java: package com.sishuok.architecture1; import org.springframework.beans.factory.annotatio ...
- Java高级架构师(一)第25节:实现前端的业务登录等功能
package com.sishuok.architecture1; import javax.servlet.http.Cookie; import javax.servlet.http.HttpS ...
- Java高级架构师(一)第19节:X-gen生成相应的Visitor
package cn.javass.themes.smvcsm.visitors; import cn.javass.xgen.genconf.vo.ExtendConfModel; import c ...
随机推荐
- Things To Do Before NOI2017
TC div1 10套 数据结构 25题 网络流 10题 字符串 20题 数学 15题 图论 15题 计算几何 5题 提交答案 5题 嗯...先这些吧... 以上所有题目,博客都会有更新--- NOI ...
- 阶段性总结⓵触摸事件&手势识别⓶Quartz2D绘图⓷CALayer图层⓸CAAnimation⓹UIDynamic UI动力学⓺KVC&KVO
知识点复习 1. 触摸事件&手势识别 1> 4个触摸事件,针对视图的 2> 6个手势识别(除了用代码添加,也可以用Storyboard添加) 附加在某一个特定视图上的, ...
- 【转】vs2015一键卸载干净
插件是国外的一位同行写的,偶然在网上发现感觉挺好用,分享一下. 第二步.下载工具并解压 网盘下载地址:https://pan.baidu.com/s/1eSHRYxW 也可以在Github上下载最新版 ...
- linux基础——关于chmod用户权限和文件的相关操作
第一部分:1) 新建用户natasha,uid为1007,gid为555,备注信息为“master” 操作:useradd natasha新建natasha:修改uid是,usermod -u 100 ...
- LeetCode 4 :Majority Element
problem:Given an array of size n, find the majority element. The majority element is the element tha ...
- python面向对象之__new__方法
众所周知,python中定义的类在创建实例对象的时候,会自动执行__init__()方法,但是在执行__init__()方法之前,会执行__new__()方法. __new__()的作用主要有两个. ...
- jq TAB切换
<a href="http://www.w3.org/1999/xhtml">" target="_blank">http://ww ...
- 肢解 HTTP 服务器构建
更好阅读请戳 这里 1. 最简单的 http 服务器 // server.js var http = require("http"); http.createServer(func ...
- Java 原子性引用 AtomicReference
http://www.jianshu.com/p/882d0e2c3ea6 实现 原子操作 使用场景: 一个线程使用student对象,另一个线程负责定时读表,更新这个对象.那么就可以用AtomicR ...
- 举例说明如何使用【聚合数据】的API接口
0 注册[聚合数据]的账号 登陆www.juhe.cn,如图,如果没有账号,注册一个(手机号或者邮箱注册),如果有直接登陆即可. 1 搜索所需的API接口 找到聚合数据主页,在搜索框输入你想搜索的AP ...