提问springMVC问题求助:PageNotFound.noHandlerFound

想问下 在springmvc.xml里配置了<mvc:default-servlet-handler/>,但是还是访问不到静态资源可能是什么问题呢(虚拟路径为/spring)

类似这种报错

警告 [http-nio-8081-exec-8] org.springframework.web.servlet.PageNotFound.noHandlerFound No mapping found for HTTP request with URI [/spring/plugins/bootstrap-slider/bootstrap-slider.js] in DispatcherServlet with name ‘DispatcherServlet’

想转到一个业务方法也不行

报错:org.springframework.web.servlet.PageNotFound.noHandlerFound No mapping found for HTTP request with URI [/spring/role/list] in DispatcherServlet with name ‘DispatcherServlet’

前端:

<li>
  <a href="${pageContext.request.contextPath}/role/list"> 
    <i class="fa fa-circle-o"></i> 角色管理
  </a>
</li>

业务:

@RequestMapping("/role")
@Controller
public class RoleController {

    @Autowired
    private RoleService roleService;

    @RequestMapping("/list")
    public ModelAndView list() {
        ModelAndView modelAndView = new ModelAndView();
        List<Role> roleList = roleService.list();
        // 设置model
        modelAndView.addObject("rolelist", roleList);
        // 设置转发页面
        modelAndView.setViewName("role-list");
        return modelAndView;
    }

}

 

请登录后发表评论

      • SpringFans的头像-SpringForAll社区SpringFans超级版主1