Fight the Future

Java言語とJVM、そしてJavaエコシステム全般にまつわること

Introducing Apache Wicketの超意訳(6)

http://www.theserverside.com/tt/articles/article.tss?l=IntroducingApacheWicket

Application(アプリケーション)

Unlike most web application frameworks, Wicket doesn't use XML for configuration.
Other than minimal configuration in the web.xml deployment descriptor,
all application configuration resides in your Application subclass.
(Fans of Jetty's programmatic configuration will certainly appreciate this.)
The application class configures every aspect of your application,
including the application home page and error handling.

ほとんどのWebアプリケーションフレームワークと異なり、WicketXMLで設定しません。
デプロイメントディスクリプタweb.xmlで最小限の設定をする意外、
アプリケーションの設定はすべてアプリケーションのサブクラスに定義します。
(Jettyでのプログラムでの設定が好きな人はこのことを確実に評価するでしょう。)
アプリケーションクラスはアプリケーションのすべての項目を設定します。
そこにはアプリケーションのホームページやエラー処理も含みます。

With a brief understanding of Wicket's core concepts, we're ready to build our example application.

Wicketの核となるコンセプトの概要を理解したので、もうサンプルアプリケーションを構築できます。

Your First Wicket Application(はじめてのWicketアプリケーション)

It's tradition to provide a "Hello World" application when introducing a new framework or language.
We're going to break with tradition to get directly to our application - a simple contact application.
Our example will only have a few pages, but in those few pages we'll reinforce the concepts presented above.

新しいフレームワークや言語を紹介するとき、「Hello World」アプリケーションを作成するのが通例です。
この通例を壊して簡単なコンタクトアプリケーションをいきなり作ってみましょう。
サンプルは数ページしかありませんが、そこで上述したコンセプトを補強します。

When you're building the web part of a web application,
it's often easiest to start with the markup and implement down to your service layer.
That's the approach we're taking.
Let's take a look at the page mockups:

WebアプリケーションのWeb部分を構築するとき、たいていはマークアップから初めてサービス層に実装を進めるのが最も簡単です・
ここでもそのアプローチを取ります。
ページのモックアップを見てみましょう。

For this application, we're implementing three pages.
The first page lists the contacts in our database.
The list page also acts as the application home page.
The remaining pages provide view and edit functions.
Each page is different, but there are certain shared aspects we'll take advantage of when building our Wicket application:

このアプリケーションではページを3つ実装します。
最初のページはデータベースにあるコンタクトを一覧にして表示します。
リストページはアプリケーションのホームページでもあります。
残りのページは照会と参照機能を提供します。
各ページは異なりますが、Wicketアプリケーションを構築するときにうまく利用するある共通した側面があります。

  • Each page shares the same stylesheet and header information. We'll take advantage of this by using markup inheritance.
  • Each page has a search box, making it ideal to encapsulate in a reusable Panel component. (We could simply include the search components in the base page, but that's not a very interesting example.)

Now that we've got the page mockups and some basic implementation ideas,
let's look at the application structure created by the Wicket Quickstart Maven archetype
(you can learn more about the Quickstart archetype here http://wicket.apache.org/quickstart.html:

さてページのモックアップと基になる実装のアイデアができました。
WicketのクイックスタートとなるMavenアーキタイプが生成したアプリケーションの構造を見てみましょう。
(クイックスタートのアーキタイプについては次のサイトを参照してください。http://wicket.apache.org/quickstart.html)

With the application boilerplate provided for us, we can start by updating the WicketApplication class.

アプリケーションのお決まりとして、WicketApplicationクラスを更新することから始めます。