MainController.java 930 B

1234567891011121314151617181920212223242526272829303132
  1. package com.izouma.awesomeadmin.web;
  2. import org.springframework.stereotype.Controller;
  3. import org.springframework.web.bind.annotation.PathVariable;
  4. import org.springframework.web.bind.annotation.RequestMapping;
  5. import org.springframework.web.bind.annotation.RequestMethod;
  6. import org.springframework.web.bind.annotation.ResponseBody;
  7. import org.springframework.web.servlet.ModelAndView;
  8. import javax.servlet.http.HttpServletRequest;
  9. /**
  10. * 首页
  11. * Created by xiong on 2016/10/26.
  12. */
  13. @Controller
  14. public class MainController {
  15. // @RequestMapping(value = "/index", method = RequestMethod.GET)
  16. // @ResponseBody
  17. // public ModelAndView home() {
  18. // return new ModelAndView("redirect:/admin");
  19. // }
  20. @RequestMapping("/{viewName}")
  21. public ModelAndView index(HttpServletRequest request, @PathVariable("viewName") String viewName) {
  22. return new ModelAndView("html/" + viewName + ".html");
  23. }
  24. }