Package net.baguajie.web.mvc.controllers

Source Code of net.baguajie.web.mvc.controllers.ViewSpotPlaceController

package net.baguajie.web.mvc.controllers;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import net.baguajie.domains.Place;
import net.baguajie.repositories.PlaceRepository;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
@RequestMapping("/spots")
public class ViewSpotPlaceController {

  @Autowired
  PlaceRepository placeRepository;

  @RequestMapping(value="/place/{id}", method=RequestMethod.GET)
  public String view(@PathVariable String id, Model model,
      HttpServletRequest request, HttpSession session){
    Place place = placeRepository.findOne(id);
    model.addAttribute("place", place);
    return "spots/place";
  }
 
}
TOP

Related Classes of net.baguajie.web.mvc.controllers.ViewSpotPlaceController

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.