Introduction This example will show how to make a simple layout using FreeMarker ( I used version 2.3.15 ) as the template engine. In previous posts, I used almost the same example with Tiles 2 and StringTemplate. This is not an introduction to FreeMarker, since the site of the product contains a very complete documentation. Anyway, I think this example doesn’t require the reader to know all the d
FreeMarkerってべんりですよね! functionとかmacroで簡単なロジックも書けたりとか! でもなんかもうちょっとfunctionで色々やりたいとか思ったりもしますよね!しませんか! ぼくはしたのでやってみました! FreeMarker Manual - FAQ FreeMarker Manual - Bean wrapper このへんを軽く流し読みした限りだとTemplateMethodModelExを実装したクラスをConfiguration#setSharedVariableにぶちこめばいける雰囲気です。 その前にTemplateMethodModelっていうのもあってこれがTemplateMethodModelExと何が違うのかわかんないのでjavadocを見ます。 TemplateMethodModel (FreeMarker 2.3.20 API) Templat
Freemarkerのリファレンスの中でよく使用するものを日本語で解説。非エンジニアでも下記に書かれている一覧を覚えれば一通りのことはできるはず。 <#-- コメント --> 「<#--」で始め「-->」で閉じるとコメントになりHTMLコードに表示されない。 <#-- コメントが入ります。 --> <#include> ファイルを読み込んで表示する <#include "hoge.ftl"> <#global> グローバル変数を定義 <#global x = "hoge"> <#assign> 名前空間で有効な変数を定義 <#assign x = "hoge"> <#local> ローカル変数を定義 <#local x = "hoge"> デフォルト値の設定 変数がundefinedのときに表示する値を指定 ${title!"無題"} ?number 数値に型変換 <#assign num
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く