码迷,mamicode.com
首页 > 编程语言 > 详细

itemController.java

时间:2017-04-26 19:24:58      阅读:177      评论:0      收藏:0      [点我收藏+]

标签:control   bsp   iphone   public   联想笔记本   factor   slist   obj   exce   

package com.wolf.controller;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.wolf.po.Items;

import com.wolf.service.ItemsServiceInf;

@Controller
public class ItemList {
@Autowired
private ItemsServiceInf itemsMapper;
@RequestMapping("/itemList")
public ModelAndView itemList() throws Exception {
List<Items> itemList = new ArrayList<>();
//List<Items> itemList = itemsMapper.list();
//商品列表
Items items_1 = new Items();
items_1.setName("联想笔记本_3");
items_1.setPrice(6000f);
items_1.setDetail("ThinkPad T430 联想笔记本电脑!");

Items items_2 = new Items();
items_2.setName("苹果手机");
items_2.setPrice(5000f);
items_2.setDetail("iphone6苹果手机!");

itemList.add(items_1);
itemList.add(items_2);
//创建modelandView对象
ModelAndView modelAndView = new ModelAndView();
//添加model
modelAndView.addObject("itemsList", itemList);
//添加视图
modelAndView.setViewName("items/itemsList");
// modelAndView.setViewName("itemsList");
return modelAndView;
}

}

 

itemController.java

标签:control   bsp   iphone   public   联想笔记本   factor   slist   obj   exce   

原文地址:http://www.cnblogs.com/lingasher/p/6770058.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!