かなりよくある質問


以下、http://wiki.apache.org/jakarta-tapestry/MoreFrequentlyAskedQuestions の抜粋andOr要約andOr追記

ページからページに情報を渡すには?

以下のようにします。

呼び元
public void submitAction(IRequestCycle cycle) {
  // The next page we want to go to is the Result page
  AppointmentPage next_page = (AppointmentPage)cycle.getPage("Appointment");
  next_page.setDate(new Date());
  next_page.setEvent(“Birthday Party”);
  cycle.activate(next_page);
}
Appointment ページ仕様
<property-specification name="date" type="java.lang.Date" persistent="yes"/>
<property-specification name="event" type="java.lang.String" persistent="yes"/>
Appointment ページクラス:
/*
**  Generated derived class implements these routines and connects them to the properties.
**  You only need to create these abstract routines if you are referencing them within the
**  abstract class.
*/
public abstract void setDate(Date date); 
public abstract void setEvent(String event); 
public abstract Date getDate(); 
public abstract String getEvent(); 

新しくページを作成したけど、'class instantiation problem'と言われてインスタンスに出来ないのですが

作ったページクラスがabstractなのが原因です。abstractなプロパティがある場合、必ず<property-specification>でページ仕様に記述していないとそのクラスのインスタンス生成に失敗します。
でも、3.0.1からは大丈夫になりました。

二つのTapestryアプリケーション間でデータのやり取りをしたいのですが

できません。一つにマージするか、DBMSやOSのメッセージパッシングなどの低レベルな方法で実現するしかありません。

Spindleって何ですか?

Tapestryの開発を支援するEclipseプラグインです。
eclipse3.0で動作させるためには3.0.xではなく3.1.xを使うべきです。

jwcid=$content$タグは何ですか?また、jwcid=$remove$タグは何ですか?

Tapestryは、HTML内に

<span jwcid=”$content$”></span>

があると、そのタグに囲まれていない部分は処理しません。
$remove$は、上記$content$と逆で、

<span jwcid=”$remove$”></span>

がHTMLに記述されていると、Tapestryはそのタグ内に書かれている内容を無視します。$remove$と$content$をうまく使うことで、Tapestryを介さずにHTMLの静的な状態(紙芝居)のレイアウトの確認が出来るようになります。

なぜかVisitがいつもnullだったり、NoClassDefFoundErrorが投げられたりします

アプリケーション仕様にVisitの定義を書いていないからじゃないですかね?

MyApp.application
<property name="org.apache.tapestry.visit-class" value="some.example.Visit" />
AppointmentPage.java
Public void submit() {
        // getVisit() will need to be casted to the defined Visit class
        some.example.Visit visit = (some.example.Visit)getPage().getVisit();
}

コンポーネントのプロパティを覚えとかせるにはどうしたらいいのですか?

<property-specification> にpersist="yes" を記述すれば、ページであってもコンポーネントであっても同様のメカニズムでHttpSession内にそのプロパティの内容を保持します。