Skip to content

Instantly share code, notes, and snippets.

@rohman
Last active December 16, 2015 00:49
Show Gist options
  • Save rohman/5350308 to your computer and use it in GitHub Desktop.
Save rohman/5350308 to your computer and use it in GitHub Desktop.
Ulang Spring mvc
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package id.web.rohman.ulangspring.controller;
import id.web.rohman.ulangspringservice.model.Tamu;
import id.web.rohman.ulangspringservice.service.api.TamuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
/**
*
* @author syahril
*/
@Controller
public class TamuController {
@Autowired
private TamuService tamuService;
@RequestMapping("/tamu/list")
public ModelMap list()
{
ModelMap data = new ModelMap();
data.addAttribute("tamuList", tamuService.listTamu());
return data;
}
@RequestMapping("/tamu/view")
public ModelMap view(@RequestParam(value="id") Integer id)
{
Tamu t = tamuService.findTamuById(id);
ModelMap data = new ModelMap();
data.addAttribute("detailTamu", t);
return data;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment