Spring Boot异常

1、使用thymeleaf模板异常

项目在myeclipse启动后访问正常,但是打包成jar后,启动后访问页面异常,异常信息如下

异常信息:template might not exist or might not be accessible by any of the configured Template Resolvers

解决方法:把路径前面的斜杠去掉

例如

@RequestMapping(value="/admin",method = RequestMethod.GET)
public String mainPage(HttpServletRequest request,HttpServletResponse response,Model model){
try{
    if(request.getSession().getAttribute("messageName")==null)
        response.sendRedirect("http://"+WeiXinBUS.weixin_web_url+"/adminLogin.html");
}
catch(Exception e){e.printStackTrace();}
    model.addAttribute("username",request.getSession().getAttribute("messageName"));//将用户名保存到参数中
    //return "/administer/administer";  //myeclipse上启动访问正常,打包成jar后启动访问报错

    return "administer/administer";   //去掉斜杠‘/’后jar启动访问就可以正常了
}

 

posted on 2017-12-23 22:33  玄门主宰  阅读(139)  评论(0编辑  收藏  举报

导航