一个列表的模块统一
来源:互联网 发布:华傲数据借壳天源迪科 编辑:程序博客网 时间:2024/05/22 17:29
1
<table width="100%" border=1><tr><td>商品名称</td><td>商品价格</td><td>生产日期</td><td>商品描述</td><td>操作</td></tr><c:forEach items="${itemsList }" var="item"><tr><td>${item.name }</td><td>${item.price }</td><td><fmt:formatDate value="${item.createtime}" pattern="yyyy-MM-dd HH:mm:ss"/></td><td>${item.detail }</td><td><a href="${pageContext.request.contextPath }/items/editItems.action?id=${item.id}">修改</a></td></tr></c:forEach></table>
2
@Controller@RequestMapping("/items")public class ItemsController {@Autowiredprivate ItemsService itemsService;// 商品查询列表@RequestMapping("/queryItems")public ModelAndView queryItems(HttpServletRequest request) throws Exception {//测试forward后request是否可以共享System.out.println(request.getParameter("id"));// 调用service查找 数据库,查询商品列表List<ItemsCustom> itemsList = itemsService.findItemsList(null);// 返回ModelAndViewModelAndView modelAndView = new ModelAndView();// 相当 于request的setAttribut,在jsp页面中通过itemsList取数据modelAndView.addObject("itemsList", itemsList);modelAndView.setViewName("items/itemsList");return modelAndView;}
3
接口
<span style="white-space:pre"></span>// R.商品查询列表/** * * <p>Title: findItemsById</p> * <p>Description: </p> * @param 商品查询列表 * @return * @throws Exception */public List<ItemsCustom> findItemsList(ItemsQueryVo itemsQueryVo) throws Exception;
实现
@Autowiredprivate ItemsMapper itemsMapper;// 列表@Overridepublic List<ItemsCustom> findItemsList(ItemsQueryVo itemsQueryVo)throws Exception {//通过ItemsMapperCustom查询数据库return itemsMapperCustom.findItemsList(itemsQueryVo);}
4
接口
public interface ItemsMapperCustom {// 商品查询列表public List<ItemsCustom> findItemsList(ItemsQueryVo itemsQueryVo)throws Exception;}实现
<?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" ><mapper namespace="com.wyz.ssm.mapper.ItemsMapperCustom" > <!-- 定义商品查询的sql片段,就是商品查询条件 --> <sql id="query_items_where"> <!-- 使用动态sql,通过if判断,满足条件进行sql拼接 --> <!-- 商品查询条件通过ItemsQueryVo包装对象 中itemsCustom属性传递 --> <if test="itemsCustom!=null"> <if test="itemsCustom.name!=null and itemsCustom.name!=''"> items.name LIKE '%${itemsCustom.name}%' </if> </if> </sql> <!-- 商品列表查询 --> <!-- parameterType传入包装对象(包装了查询条件) resultType建议使用扩展对象 --> <select id="findItemsList" parameterType="com.wyz.ssm.po.ItemsQueryVo" resultType="com.wyz.ssm.po.ItemsCustom"> SELECT items.* FROM items <where> <include refid="query_items_where"></include> </where> </select> </mapper>
5
6
0 0
- 一个列表的模块统一
- 统一的统一发衣服一个富有光伏股
- 一个统一的链表结构
- 给js设定一个统一的入口
- VLC可用的模块列表!
- VLC可用的模块列表
- c++11---统一的初始化和初始化列表
- IIS发布网站后出现“处理程序"PageHandlerFactory-Integrated"在其模块列表中有一个错误模块”的解决方法
- iOS尝试用测试驱动的方法开发一个列表模块【一】
- iOS尝试用测试驱动的方法开发一个列表模块【二】
- iOS尝试用测试驱动的方法开发一个列表模块【三】
- iOS尝试用测试驱动的方法开发一个列表模块【四】
- iOS尝试用测试驱动的方法开发一个列表模块【五】
- 在部署一个IIS7程序时的问题 模块列表中不存在为此处理程序指定的一个或多个模块。如果您尝试添加脚本 映射,则 IsapiModule 或 CgiModule 不会显示在模块列表中
- 经常会遇到一个程序模块先有一个列表区接着再编辑表单的问题
- 一个列表的练习
- pdf 的一个模块~~
- 左右列表动态统一高度
- C#学习笔记------1、C#的基本知识
- BST插入、删除、求高和层次遍历的实现
- 【汇总】东南大学风景园林学2012-2016年考研报录比
- 854计算机基础——《计算机组成原理》考点汇总(一)计算机系统概论
- Android-Fragment总结
- 一个列表的模块统一
- 第五周项目三-括号的匹配
- iOS开发 — OSChina上部署项目
- 从 MVC 到前后端分离
- 第5周项目5-后缀表达式
- Linux入门:常用命令:bg、fg、jobs程序后台运行及唤醒
- MySql存储引擎MyISAM和InnoDB的区别
- redis的安装
- 第五周c语言编程项目3--求工资