入门到放弃_2

Spring+SpringBoot+MyBatis开发

问题:运行项目时如何修改请求界面。

方法:添加控制器,在控制器里设置请求路径的转映射

代码如下:

package com.demo.contollers;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

/**
* 请求路径转映射控制器
* @author Teacher
* @createTime 2018年10月11日 下午4:46:32
* @lastTime 2018年10月11日 下午4:46:32
* @version 1.0.0
*/
 @Controller
 public class PathHandlerContoller {

  @RequestMapping("/")
  public String loginMapper() throws Exception {
  //return "redirect:login.html";
  return "firstPage.html";
  }

  @RequestMapping("/userlist.html")
  public String userMapper() throws Exception {
  return "system/user/userlist";
  }

}

原文地址:https://www.cnblogs.com/wang-hao/p/9910169.html