FreeMarkerテンプレートエンジン【Velocityよりずっとまし】 (100レス)
1-

1
(1): 1 2005/07/05(火)08:21 ID:??? AAS
内容:
FreeMarkerは、Java用としては現時点で最強のテンプレートシステム。
Velocityなんか目じゃないぐらい、簡単、高機能、高性能(最大で約2倍速い)。
WebWork2もVelocityからFreeMarkerに乗り換えた。

本家
外部リンク:freemarker.sourceforge.net
特徴
外部リンク[html]:freemarker.sourceforge.net
Velocityとの比較
外部リンク[html]:freemarker.sourceforge.net
省3
2: 2005/07/05(火)09:45 ID:??? AAS
ハッシュドビーフ
3: 2005/07/05(火)15:37 ID:??? AAS
Velocityとの比較を見てると、Velocityってそんなこともできなかったのねと思ったりするが、なぜこの板なのかという疑問は解消できない。
4: What is FreeMarker? [FreeMarkerって何よ?] 2005/07/08(金)01:35 ID:??? AAS
What is FreeMarker?

FreeMarkerって何よ?

FreeMarker is a "template engine"; a generic tool to generate text
output (anything from HTML to autogenerated source code) based on
templates. It's a Java package, a class library for Java programmers.
It's not an application for end-users in itself, but something that
programmers can embed into their products.

FreeMarkerとは、テンプレートに基づいてテキスト出力(HTMLからソースコード
まで何でも)を生成する汎用のツール、つまり「テンプレートエンジン」です。
FreeMarkerはJavaパッケージ(Javaプログラマーのためのクラスライブラリ)で
省2
5: 2005/07/08(金)01:42 ID:??? AAS
FreeMarker is designed to be practical for the generation of HTML Web
pages, particularly by servlet-based applications following the MVC
(Model View Controller) pattern. The idea behind using the MVC pattern
for dynamic Web pages is that you separate the designers (HTML authors)
from the programmers. Everybody works on what they are good at.
Designers can change the appearance of a page without programmers having
to change or recompile code, because the application logic (Java
programs) and page design (FreeMarker templates) are separated.
Templates do not become polluted with complex program fragments. This
separation is useful even for projects where the programmer and the HMTL
省14
6: 2005/07/08(金)01:50 ID:??? AAS
Although FreeMarker has some programming capabilities, it is not a
full-blown programming language like PHP. Instead, Java programs prepare
the data to be displayed, and FreeMarker just generates textual pages
that display the prepared data using templates.

FreeMarkerはいくらかのプログラミング機能を持っていますが、PHPのような本
格的なプログラミング言語ではありません。表示すべきデータはJavaプログラム
で用意し、FreeMarkerはそのデータからテンプレートを用いてテキストベースの
ページを生成するだけです。

Overview of FreeMarker workflow

FreeMarkerによるワークフローの概観
省2
7: 2005/07/08(金)01:57 ID:??? AAS
FreeMarker is not a Web application framework. It is suitable for a
component in a Web application framework, but the FreeMarker engine
itself knows nothing about HTTP or servlets. It simply generates text.
As such, it is perfectly usable in non-web application environments as
well. Note, however, that we provide out-of-the-box solutions for using
FreeMarker as the view component of Model 2 frameworks (e.g. Struts),
which also let you use JSP taglibs in the templates.

FreeMarkerはWebアプリケーションフレームワークではなく、Webアプリケーショ
ンフレームワークの1コンポーネントとして存在するのが適切です。しかし
FreeMarkerエンジン自体はHTTPやServletとは何の関係もありません。エンジン
省4
8: 2005/07/08(金)02:02 ID:??? AAS
OSI Certified FreeMarker is Free, with BSD-style license. It is OSI
Certified Open Source Software. OSI Certified is a certification mark of
the Open Source Initiative.

OSIはFreeMarkerをBSDスタイルのライセンスとともにFreeだと認定しました。
FreeMarkerはOSI認定のオープンソースソフトウェアです。OSI認定はオープンソ
ースイニシアチブの認定マークです。

Read more feature highlights.

機能の詳細についてはこちらをご覧ください。

外部リンク[html]:freemarker.sourceforge.net
省3
9: 2005/07/10(日)02:10 ID:??? AAS
ただでさえWebWork2の露出度が低いのにFreeMakerが流行るとは思えん。嫌いじゃないんだけどね。
プロジェクトに入れたくてもシラネとかいわれるしぐぐってもあまり日本語の情報がないので結局Struts + JSPあたりになっちゃうんだよなぁ。
10: FreeMarker vs. Velocity 2005/07/13(水)01:39 ID:??? AAS
FreeMarker vs. Velocity
外部リンク[html]:freemarker.sourceforge.net

Velocity is a simpler, more lightweight tool. Thus, it does not address
many tasks that FreeMarker does, and its template language is less
powerful in general, but it is simpler.

Velocityはシンプルでとても軽量なツールです。しかし、FreeMarkerが解決して
いる多くの課題を、Velocityは解決できていません。またVelocityのテンプレー
ト言語はシンプルですが、一般的にいってあまり強力ではありません。
11: FreeMarker vs. Velocity 2005/07/13(水)01:41 ID:8E2e9Zlo(1) AAS
However, we think that for most applications, working with FreeMarker is
simpler than working with Velocity, since with Velocity you have to find
custom tools and find various other workarounds to solve typical
template authoring tasks again and again, and you end up losing much
more time in the long run than you have won on the quick starting. Also,
the result of solving something with tools and workarounds is most
probably not as terse or efficient as the solution in the engine core.

しかしながら、ほとんどのアプリケーションにおいて、VelocityよりFreeMarker
を使うほうがより簡単だと我々は考えています。なぜなら、テンプレートを記述
するうえでの典型的な課題を解決するのに、Velocityでは専用のツールや他のワ
省4
12: FreeMarker vs. Velocity 2005/07/13(水)01:42 ID:??? AAS
Furthermore, according to Velocity list archives, the workaround often
means extensive direct usage of Java object methods in the Velocity
template (this violates the idea of simple, non-programmer HTML-designer
friendly templates) or the movement of presentation tasks into the
controller code (this violates the MVC idea). And, after all, if you use
FreeMarker only for what Velocity can do out-of-the-box, it is as simple
as Velocity.

もっといえば、Velocityリストアーカイブ〔訳注:メーリングリストのアーカ
イブのこと?〕によれば、こういったワークアラウンドはたいてい、Velocity
テンプレートの中でJavaオブジェクトのメソッドを広範囲に直接利用することに
省4
13: FreeMarker vs. Velocity 2005/07/13(水)01:44 ID:??? AAS
An advantage of Velocity over FreeMarker is that Velocity has wider
third party support and a much larger user community. However, you might
need less support for FreeMarker because instead of creating and
discussing workarounds you might often be able to simply use FreeMarker
standard features. And in case you have difficulties there are of course
active web forums and mailing lists. Moreover, since with FreeMarker you
can use Model-2 frameworks as Struts and any JSP tag libraries
out-of-the-box, perhaps third-party support is not a that big problem if
you are in the servlet segment. Also, more and more servlet frameworks
adapt FreeMarker as their view layer, next to JSP and Velocity.
省11
14: FreeMarker vs. Velocity 2005/07/13(水)01:45 ID:??? AAS
There are other parameters that should be considered when you compare
tools, like code quality and documentation quality. But of course, we as
the authors of the product should not say anything about this. It is up
to the users to judge.

ツールを比較する際は、コードやドキュメントの品質など考慮すべき点が他にも存在します。
もちろん、我々はFreeMarkerの作者として、そういった点にも言及しなければなりません。
判断するのはユーザです。
15: FreeMarker vs. Velocity 2005/07/14(木)02:39 ID:qC0D73t6(1) AAS
Feature comparison sheet

機能比較シート

Here's a quick, non-comprehensive listing of things you can do with
FreeMarker out of the box, and which you can not do with Velocity (or,
you can but only with nontrivial workarounds). This list is originally
based on a comparison with Velocity 1.2. Contact us for change
suggestions.

これは簡単に作成したものであり包括的なものではありませんが、FreeMarkerが
素の状態でできることと、Velocityではできないこと(またはVelocityでもでき
るんだけど自明でないワークアラウンドが必要となること)の比較リストです。
省2
16: FreeMarker vs. Velocity 2005/07/14(木)02:40 ID:??? AAS
[ Number and date support ]
* You can perform arithmetic calculations and comparisons on arbitrary
number types, including the arbitrary-precision types, not just integers.
* You can compare and display (format) date/time values.

[ 数値と日付のサポート ]
* 任意の数値型による算術計算と比較ができます。整数だけでなく、任意の精度の小数を扱うことができます。
* 日付や時刻を比較したり、書式を指定して表示することができます。
17: FreeMarker vs. Velocity 2005/07/14(木)02:40 ID:??? AAS
[ Internationalization ]
* You can format numbers locale-sensitively, based on a variety of
built-in and custom number-formatting patterns.
* You can format dates locale- and timezone-sensitively, based on
variety of built-in and custom date-formatting patterns.
* Identifiers (variable names) can contain non-English letters like
accented letters, Arabic letters, Chinese letters, etc.

[ 国際化 ]
* 数値を、ロケールに従った書式に変換できます。
 書式のパターンは多くのものがあらかじめ組み込まれており、またカスタムで作成することもできます。
省4
18: FreeMarker vs. Velocity 2005/07/14(木)02:41 ID:??? AAS
[ Loop handling ]
* You can break out of loops.
* You can access control variables of outer loops from bodies of inner loops.
* You can test whether you are in the last iteration of the loop.

[ ループハンドリング ]
* breakでループを抜けることができます。
* 内部のループから、外側のループ変数にアクセスしたり変更することができます。
* ループの最後であるかどうかを判定することができます。
19: FreeMarker vs. Velocity 2005/07/14(木)02:41 ID:??? AAS
[ Array handling on the template language level ]
* You can access array elements, both primitive and non-primitive by index using the familiar [i] syntax.
* You can query the length of an array.

[ テンプレート言語レベルでの配列の扱い ]
* プリミティブか非プリミティブかに関わらず、使い慣れた「[i]」というシンタックスで配列の要素にアクセスできます。
* 配列の長さを調べることができます。
20: FreeMarker vs. Velocity 2005/07/14(木)02:42 ID:??? AAS
[ Macros ]
* Macro invocations can pass parameters either by position or by name.
* Macro parameters can have default values which are effective when the parameter is omitted on invocation.
* Macro invocations can have a nested body (<@myMacro>body</@myMacro>) that can be called by the macro for processing.
* Macros are plain variables, so you can select the macro to execute based on an expression, or pass a macro to another macro as parameter.
* Invoke a macro that is defined later in the template.
* Local variables in macros, and recursive invocation of macros. In Velocity it is now possible with the currently (Feb. 2005) not officially documented #local function.

[ マクロ ]
* マクロの呼び出しで引数を渡すことができます。また引数は、位置による指定も、名前による指定もできます。
* マクロの引数はデフォルト値を指定できます。マクロ呼び出し時に引数が指定されない場合は、デフォルト値が使用されます。
省7
1-
あと 80 レスあります
スレ情報 赤レス抽出 画像レス抽出 歴の未読スレ AAサムネイル

ぬこの手 ぬこTOP 0.319s*