Open shiotsugou opened 2 years ago
package MyshopController.controller;
import java.util.List; import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod;
@controller public class MyshopController {
@Autowired JdbcTemplate jdbcTemplate;
@RequestMapping(path = "/myshop", method = RequestMethod.GET) public String viewMyShop() { return "index"; }
@RequestMapping(path = "/about", method = RequestMethod.GET) public String viewAbout() { return "about"; }
@RequestMapping(path = "/shop", method = RequestMethod.GET) public String viewShop(Model model) { //itemテーブルにSELECT文を発行する。 List<Map<String, Object>> list; list = jdbcTemplate.queryForList("SELECT * FROM item;");
model.addAttribute("itemList", list); return "shop";
}
@RequestMapping(path = "/contact", method = RequestMethod.GET) public String viewContact() { return "contact"; } }
$250.00
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod Lorem ipsum dolor sit amet.
package MyshopController.controller;
import java.util.List; import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod;
@controller public class MyshopController {
@Autowired JdbcTemplate jdbcTemplate;
@RequestMapping(path = "/myshop", method = RequestMethod.GET) public String viewMyShop() { return "index"; }
@RequestMapping(path = "/about", method = RequestMethod.GET) public String viewAbout() { return "about"; }
@RequestMapping(path = "/shop", method = RequestMethod.GET) public String viewShop(Model model) { //itemテーブルにSELECT文を発行する。 List<Map<String, Object>> list; list = jdbcTemplate.queryForList("SELECT * FROM item;");
}
@RequestMapping(path = "/contact", method = RequestMethod.GET) public String viewContact() { return "contact"; } }