Tomcat起動時に次のようなエラーが発生する場合、
org.seasar.framework.exception.ParserConfigurationRuntimeException: [ESSR0053]パーサの設定に問題があります。理由はjavax.xml.parsers.ParserConfigurationException: Feature 'http://apache.org/xml/features/xinclude' is not recognized.
$TOMCAT/common/endorsedにある、xercesImpl.jarとxml-apis.jarを削除してください。 (Tomcat 5.5.20で確認)
以下のように、formに1つのInputTextしか無い場合に、inputTextにfocusして
Enterキーを押すとname属性がわたらず、doXxxが呼ばれない。
この現象はIEの場合のみ発生する。
<form id="form"> <span>hogehoge</span> <input type="text" id="arg1" title="INPUT1" /> <input type="submit" value="calculate" id="doCalculate"/> </form>
これを解消するには、
<input type="text" style="display: none"/>
をひとつ追加する
TeedaをWAS6.1で動かすには、
DynamicPropertyを使用してください。
http://teeda.seasar.org/ja/extension_features.html#dynamicproperty
service,dtoなどの適当なパッケージにコンポーネントを作り、
@Component(instance=InstanceType.SESSION) public class ...
のようにインスタンス属性を指定してください。
teedaErrorPage.diconに個別の例外に応じてエラーページの設定を記述します。
<component class="org.seasar.teeda.extension.util.TeedaExtensionErrorPageManagerImpl">
<!--ここから追加-->
<initMethod name="addErrorPage">
<arg>@org.seasar.framework.exception.SRuntimeException@class</arg>
<arg>"/view/error/custom.html"</arg>
</initMethod>
<!--ここまで-->
<initMethod name="addErrorPage">
<arg>@java.lang.Throwable@class</arg>
<arg>"/view/error/error.html"</arg>
</initMethod>
</component>
この場合、個別の例外の設定のほうが上にくるようにしてください。
propertiesで切り替えることが出来ます。
まずpropertiesファイルを作成して、faces-config.xmlに定義します。 (名前は一般的には、appMessages.propertiesがよく使われます) このあたりはteeda-html-exampleを参考にしてください。
そこに、 org.seasar.teeda.extension.component.TSelect.NULL_LABEL というキーで値を設定すればこのNULLラベルが使用されます。
pageクラスに、以下のプロパティを用意してください。
| クラス | プロパティ名 |
| HttpServeltRequest | - |
| HttpServeltResponse | - |
| HttpSession | - |
| ServletContext | - |
| FacesContext | facesContext |
javax.faces.internal.FacesMessageUtilを使用して、
FacesMessageUtil.addErrorMessage("E0000002");
のようにしてください。
メッセージは、 WEB-INF/faces-config.xmlで指定したプロパティファイルに記述します。
例えばノーブレークスペース(non-breaking space, NBSP)を表示したい場合、テンプレートHTML上では次のように記述します。
&
this.message = "\u00A0"
<div id ="isNotCreate" style="〜">
なタグにDynamicPropertyを設定する場合、
public String getIsNotCreateStyle() {
//略
}
となります。
TeedaはHTMLファイルをXMLとして解析するので、静的なHTMLをそのまま出力する場合にXMLとしてwell-formedでないと例外になります。
静的なHTMLは拡張子を.htmにすれば、Teedaの処理対象ではなくなるのでひとまず出力することができます。
Teeda は FacesContext を外部コンテキストに設定するので、creator.dicon で、
<component class="org.seasar.framework.container.creator.LogicCreator"> <property name="externalBinding">true</property> </component>
とすれば Logic にも FacesContext が DI されるようになります。
Helperも同様です。
Label機能を使用して、idに対する日本語名称を設定します。
http://d.hatena.ne.jp/dewa/20070720#1184920170
Pageクラスで普通にリダイレクトしてもらえれば 問題ありません. FacesContextのresponseComplete()だけは呼び出してください.
下記のような感じです.
public String doHoge() throws IOException {
response.sendRedirect("http://www.yahoo.co.jp");
facesContext.responseComplete();
return null;
}
流れとしては以下のような手順になる
public void doDownload() {
final File file = downloadHelper.getFile("javaexpert-sample.csv");
response.setContentType("application/octet-stream");
response.setHeader("content-disposition", "attachment; filename=\""
+ file.getName() + "\"");
OutputStream os = null;
try {
os = response.getOutputStream();
os.write(FileUtil.getBytes(file));
} catch (IOException e) {
throw new AppFacesException("E0000002");
} finally {
try {
os.close();
} catch (final IOException e) {
}
}
this.facesContext.responseComplete();
}
1.0.13 からは Teeda の FileUpload コンポーネントを使うことができます.
http://teeda.seasar.org/ja/extension_features.html#fileupload
1.0.12 以前の場合は,TomahawkのFileUploadを使います。
http://d.hatena.ne.jp/shot6/20061122#1164175683
Teeda 1.0.8-RC1までは上記方法で動作するのを確認しています。
http://d.hatena.ne.jp/dewa/20070808#1186573480
foreachを使う場合、DTOやMapで持っているIDと同じフィールドを、Pageの方にも持たせる必要があります。
特定のPageだけなら、Pageクラスに
@Aspect(インターセプタ名)
public String doHoge() {
...
}
のようにアノテーションを指定します。
Seasar2のデフォルトでは、aspectはそのクラスのインターフェースで定義されているメソッドに適用されます。
TeedaのPageクラスはインターフェースを持ってないので、cunstomizer.diconでcustomizerの設定をするときに
<property name="pointcut">"do.*, initialize, prerender"</property>
のようにポイントカットを指定する必要があります。
http://d.hatena.ne.jp/yone098/20070122/1169446352
をご参照ください。
Pageがもっているプロパティの型とDto/Mapのプロパティの型が一致しているか確認してください。