Apache Wicket
Apacheソフトウェア | |
9.2.0
/ 2020 | |
リポジトリ | |
プラットフォーム | クロスプラットフォーム |
Webアプリケーションフレームワーク | |
ライセンス | Apache License 2.0 |
http://wicket.apache.org |
Apache Wicket(アパッチ・ウィケット)は、Apacheソフトウェア
概要
[2007
wicketには、
2011
特徴
[Webアプリケーションフレームワークで
Wicketは、これとは
Wicketから
Wicketが
Wicket 独自 拡張
[Wicketが
- wicket:link
- wicket:panel
- wicket:fragment
- wicket:border
- wicket:body
- wicket:extend
- wicket:child
- wicket:message
- wicket:remove
- wicket:head
- wicket:enclosure
- wicket:container
Wicketが
- wicket:id
- wicket:message
- wicket:enclosure
- wicket:for
- wicket:unknown
- wicket:scope
プログラム例
[Hello worldを
- HelloWorld.html
- テンプレートとなるXHTMLファイル。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.3-strict.dtd"
xml:lang="ja" lang="ja">
<body>
<span wicket:id="message" id="message">ここにメッセージが表示 される。</span>
</body>
</html>
- HelloWorld.java
- ページ・クラス。クラス
名 と同 じ名前 のHTML/XHTMLテンプレート(この場合 、HelloWorld.html)を読 み込 む。 - テンプレート
中 にあるwicket:id属性 が"message"となっているタグの内容 を指定 した文字 列 ("ハロー・ワールド!")に置 き換 える。
package org.wikipedia.ja.wicket;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.basic.Label;
public class HelloWorld extends WebPage {
/**
* Constructor
*/
public HelloWorld() {
add(new Label("message", "ハロー・ワールド!"));
}
}
- HelloWorldApplication.java
- Applicationオブジェクト。
- アプリケーションをWebコンテナにロードするときの
開始 点 となる。
package org.wikipedia.ja.wicket;
import org.apache.wicket.protocol.http.WebApplication;
public class HelloWorldApplication extends WebApplication {
/**
* Constructor.
*/
public HelloWorldApplication() {
}
/**
* @see org.apache.wicket.Application#getHomePage()
*/
public Class getHomePage() {
return HelloWorld.class;
}
}
- web.xml
- Wicketサーブレット・クラスを
定義 し、クラスにアプリケーション・クラス名 をパラメーターとして指定 する。
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5">
<display-name>Wicket Example</display-name>
<filter>
<filter-name>HelloWorldApplication</filter-name>
<filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
<init-param>
<param-name>applicationClassName</param-name>
<param-value>org.wikipedia.ja.wicket.HelloWorldApplication</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>HelloWorldApplication</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
脚注
[参考 書籍
[- 「オープンソース
徹底 活用 WicketによるWebアプリケーション開発 」矢野 勉 ISBN 978-4798022215