场景是:我现在有一个index.html首页,首页上有两个可以根据url跳转到其他页面的add链接和update链接
目前是我只要经过首页,点击连接就能跳转到这俩界面,现在我要add页面经过认证之后了才能进行跳转,否则跳转不过去
首页
controller层路径映射跳转
package com.kuang.controller;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.IncorrectCredentialsException;
import org.apache.shiro.authc.UnknownAccountException;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.subject.Subject;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
public class MyController {
@RequestMapping({"/","/index"}) //进入首页
public String toIndex(Model model){
model.addAttribute("msg","hello,shirol");
return "index";
}