*JSFとStruts [#g80d6fa8] *目次 [#qf5e3e38] #contents *目的 [#s958ed84] 個人的には、今の開発現場がstruts1を使っているっていう事情があるので、struts1中心にしらべています。 開発の最短の手順の調査として、JSFの表作製を使った場合のメンテナンス性について考察することに留意しながらまとめております。 *StrutsとJSFを統合するライブラリ「Struts-faces」 [#b7e2b852] 本家 http://struts.apache.org/1.x/struts-faces/ *本体のダウンロード [#ob73466c] http://struts.apache.org/download.cgi *struts1の取説 [#r2b5e790] http://struts.apache.org/1.x/userGuide/index.html *struts2は別物であるという意見 [#tde5cd56] http://d.hatena.ne.jp/ryoasai/20101014/1287063322 **サンプルコード [#q066cb1d] 下記のURLでサンプルが紹介されている http://struts.apache.org/1.x/struts-apps/index.html ***Faces Example 1 [#tf2833da] Struts の古典的なメールリーダのrenditionでJSFが使えるようになっている。 ***Faces Example 2 [#w233874d] さらにTilesも使っているのが、Example2である。 *キャッシュに残らないように [#v7a0d95c] 開発時にキャッシュに残っていると、原因の特定を妨げるケースが多々ある 下記のようにキャッシュをためないように実装する必要がある。 ただし、開発時のみ <% response.setHeader("Pragma","no-cache"); response.setHeader("Cache-Control","no-cache"); response.addHeader("Cache-Control","no-store"); response.setDateHeader("Expires",0); %> *XMLを出力 [#g167bf14] <%@ page language="java" contentType="text/xml; charset=UTF-8" %> <%@ page language="java" contentType="application/xml; charset=UTF-8" %> <?xml version="1.0" encoding="UTF-8"?> *JavascriptでXMLをリクエスト [#je9e33be] **XMLHttpRequestを生成する [#o0e64f2d] http://www.gesource.jp/programming/javascript/20060501.html **リクエストを送信してXMLを受信する [#u0d747be] http://www.gesource.jp/programming/javascript/20060507.html **JQueryでリクエストを送信 [#u2dd6d65] http://allabout.co.jp/gm/gc/24214/ *xxxtagligb.tldのタグ定義を作る [#s79af63b] サンプルを見ると中身はXMLで記述された定義ファイルである。このファイルをJSPが呼んでいて、このファイルから、Classが呼ばれている。という仕組みらしい。 <tag> <description>Outputs Hello, World</description> <name>helloWorld</name> <tag-class>jsp2.examples.simpletag.HelloWorldSimpleTag</tag-class> <body-content>empty</body-content> </tag> *タグクラスを作る [#v628e7d0] public class HelloWorldSimpleTag extends SimpleTagSupport { public void doTag() throws JspException, IOException { getJspContext().getOut().write( "Hello, world!" ); } } *タグをJSPで使う [#i2cc0d74] <%@ taglib prefix="mytag" uri="/WEB-INF/jsp2/jsp2-example-taglib.tld" %> <mytag:helloWorld/> *サンプル [#i5f7ea02] http://www.jajakarta.org/struts/struts1.1/documentation/ja/target/resources/projects.html *リンクのイテレート [#zc000cda] http://www.ne.jp/asahi/hishidama/home/tech/struts/logic_iterate.html#h_link