标签:pre log 全局异常处理 日志 视图解析器 图解 for == nbsp
1、日志:
spring5 不在使用org.springframework.web.util.Log4jConfigListener,不能配置log4j监听器,可以使用log4j2进行日志记录。
2、springmvc整合thymeleaf:
配置文件中添加<property name="viewNames" value="*.html,*.xhtml" />则无法进行解析,报500错误,原因不明。
3、使用全局异常处理器:
同时在web.xml页面中获拦截404、500等错误,是否同时使用,thymeleaf中怎么直接获取exception异常?
4、跟目录访问可以直接跳转到指定视图解析器,index.html需要经过视图解析器,不然渲染不出来
<mvc:view-controller path="/" view-name="forward:/hello"/>
5、时刻检查target文件是否更新,idea更新延迟。
6、thymeleaf中使用th:if应注意第一次获取session中的值应使用request.
<!--第一次必须使用request请求获取session,不然session不会产生-->
<li><a th:href="@{/login}" th:if="${#request.getSession().getAttribute(‘username‘)} == null" th:text="登录"></a></li>
标签:pre log 全局异常处理 日志 视图解析器 图解 for == nbsp
原文地址:https://www.cnblogs.com/baldprogrammer/p/13646991.html