スキップしてメイン コンテンツに移動

投稿

ラベル(template)が付いた投稿を表示しています

Spring BootでThymeleafのキャッシュをオフにする方法

Spring BootでテンプレートエンジンとしてThymeleafを使っていると、デフォルトではキャッシュが効いて、開発時にテンプレートを修正するたびにアプリケーションを再起動する必要があます。 Thymeleafのキャッシュをオフにするにはapplication.propertiesに下記の設定を加えればOKです。 spring.thymeleaf.cache: false これによりページリロードの度に毎回テンプレートの解析が行われ、編集内容がすぐに反映されるようになります。 本番デプロイ時は設定を無効にすることを忘れないようにしてください。

Html Layout by JSP

Introduction In this post, I will introduce how to achieve html layout by jsp. You just define layout and put piece of elements in each actual jsp. I won't explain details but just show you an quick example for sharing "header & footer" in all jsp pages. If you are interested in how & why it works, please refer jsp documentation (or googling). Code Simply you need to prepare a layout tag file and actual jsp files. Prepare layout.tag (actually name is not so important) and put it under WEB-INF/tags. Put header.jsp and footer.jsp under WEB-INF/views/ Create actual jsp which include taglib you previously defined above step. Ok now I will show you the actual codes. layout.tag A key part is using fragment feature. <%@tag description="Layout template" pageEncoding="UTF-8"%> <%@attribute name="main" fragment="true" %> <%@attribute name="head" fragment="true" %> <%@attribu