RichFaces3 ShowCaseのTabPanelを実行します。
【手順】
1.「RichFaces3プロジェクトの作成方法」の手順で、「RichFaces3Sample002-TabPanel」といプロジェクトを作成。
※プロジェクトの設定は以下の通り。
2.「WebContent/WEB-INF/web.xml」を以下の様に入力。
<?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>RichFaces3Sample002-TabPanel</display-name> <context-param> <param-name>javax.faces.STATE_SAVING_METHOD</param-name> <param-value>server</param-value> </context-param> <context-param> <param-name>org.richfaces.SKIN</param-name> <param-value>blueSky</param-value> </context-param> <context-param> <param-name>org.richfaces.CONTROL_SKINNING</param-name> <param-value>enable</param-value> </context-param> <filter> <display-name>RichFaces Filter</display-name> <filter-name>richfaces</filter-name> <filter-class>org.ajax4jsf.Filter</filter-class> </filter> <filter-mapping> <filter-name>richfaces</filter-name> <servlet-name>Faces Servlet</servlet-name> <dispatcher>REQUEST</dispatcher> <dispatcher>FORWARD</dispatcher> <dispatcher>INCLUDE</dispatcher> </filter-mapping> <listener> <listener-class>com.sun.faces.config.ConfigureListener</listener-class> </listener> <context-param> <param-name>javax.faces.DEFAULT_SUFFIX</param-name> <param-value>.xhtml</param-value> </context-param> <welcome-file-list> <welcome-file>faces/index.xhtml</welcome-file> </welcome-file-list> <servlet> <servlet-name>Faces Servlet</servlet-name> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>Faces Servlet</servlet-name> <url-pattern>/faces/*</url-pattern> </servlet-mapping> </web-app>
3.「Ctrl+Shift+F」を押し、ソースコードをフォーマッティング、「Ctrl+S」でファイルを保存。
4.「WebContent/WEB-INF/faces-config.xml」を以下の様に入力。
<?xml version="1.0" encoding="UTF-8"?> <faces-config xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd" version="1.2"> <application> <view-handler>com.sun.facelets.FaceletViewHandler</view-handler> </application> </faces-config>
5.「Ctrl+Shift+F」を押し、ソースコードをフォーマッティング、「Ctrl+S」でファイルを保存。
6.「任意のファイルの作成方法」の手順で、「WebContent/」ディレクトリに「index.xhtml」というファイルを作成。
7.「index.xhtml」を以下の様に入力。
<html xmlns="http://www.w3c.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich"> <head> </head> <body> <rich:tabPanel switchType="ajax"> <rich:tab label="タブ1"> タブ1の中身 </rich:tab> <rich:tab label="タブ2" disabled="true"> タブ2の中身 </rich:tab> <rich:tab label="タブ3"> タブ3の中身 </rich:tab> </rich:tabPanel> </body> </html>
8.「Ctrl+Shift+F」を押し、ソースコードをフォーマッティング、「Ctrl+S」でファイルを保存。
9.「動的Webアプリケーションをサーバーに配置する方法」の手順で、作成したプロジェクトをサーバーに配置します。
10.「サーバーをデバッグモードで起動する方法」の手順で、サーバーを起動します。
11.ブラウザで以下のURLにアクセスします。
http://localhost:8080/RichFaces3Sample002-TabPanel/faces/index.xhtml
12.以下の様に表示されれば成功です。
13.以下の様なHTMLが出力されました。
<html xmlns="http://www.w3c.org/1999/xhtml"> <head> <link class="component" href="/RichFaces3Sample002-TabPanel/faces/a4j/s/3_3_3.Finalorg/richfaces/renderkit/html/css/basic_both.xcss/DATB/eAF7sqpgb-jyGdIAFrMEaw__;jsessionid=F723F500BF5759F0E4FA09C0E157D026" rel="stylesheet" type="text/css" /> <link class="component" href="/RichFaces3Sample002-TabPanel/faces/a4j/s/3_3_3.Finalorg/richfaces/renderkit/html/css/extended_both.xcss/DATB/eAF7sqpgb-jyGdIAFrMEaw__;jsessionid=F723F500BF5759F0E4FA09C0E157D026" media="rich-extended-skinning" rel="stylesheet" type="text/css" /> <script src="/RichFaces3Sample002-TabPanel/faces/a4j/g/3_3_3.Finalorg.ajax4jsf.javascript.PrototypeScript" type="text/javascript"> </script> <script src="/RichFaces3Sample002-TabPanel/faces/a4j/g/3_3_3.Finalorg.ajax4jsf.javascript.AjaxScript" type="text/javascript"> </script> <script src="/RichFaces3Sample002-TabPanel/faces/a4j/g/3_3_3.Finalorg.ajax4jsf.javascript.ImageCacheScript" type="text/javascript"> </script> <script src="/RichFaces3Sample002-TabPanel/faces/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/scripts/browser_info.js" type="text/javascript"> </script> <script src="/RichFaces3Sample002-TabPanel/faces/a4j/g/3_3_3.Finalorg/ajax4jsf/javascript/scripts/form.js" type="text/javascript"> </script> <script src="/RichFaces3Sample002-TabPanel/faces/a4j/g/3_3_3.Finalscripts/tabPanel.js" type="text/javascript"> </script> <link class="component" href="/RichFaces3Sample002-TabPanel/faces/a4j/s/3_3_3.Finalcss/tabPanel.xcss/DATB/eAF7sqpgb-jyGdIAFrMEaw__;jsessionid=F723F500BF5759F0E4FA09C0E157D026" rel="stylesheet" type="text/css" /> <script type="text/javascript"> window.RICH_FACES_EXTENDED_SKINNING_ON=true; </script> <script src="/RichFaces3Sample002-TabPanel/faces/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/scripts/skinning.js" type="text/javascript"> </script> </head> <body> <script type="text/javascript"> RichFaces.tabPanel['j_id1']={'id':'j_id1','ontabchange':''} ; </script> <table border="0" cellpadding="0" cellspacing="0" class="rich-tabpanel " id="j_id1" style="width:"> <tbody> <tr> <td align="left" class="rich-tab-bottom-line "> <form id="j_id1:_form" name="j_id1:_form" method="post" style="margin:0; padding:0; display: inline;" action="/RichFaces3Sample002-TabPanel/faces/index.xhtml;jsessionid=F723F500BF5759F0E4FA09C0E157D026"> <!--table border="0" cellpadding="0" cellspacing="0" style="position:relative;top:1px"--> <table border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img alt="" height="1" src="/RichFaces3Sample002-TabPanel/faces/a4j/g/3_3_3.Finalimages/spacer.gif" style="width: 1px; ;border:0" /> </td> <td id="j_id2_cell" style="height: 100%; vertical-align: bottom;" class="rich-tabhdr-cell-active"> <table border="0" cellpadding="0" cellspacing="0" id="j_id2_shifted" onclick="if (RichFaces.isTabActive('j_id2_lbl')) return false; if (!RichFaces.onTabChange(event, 'j_id1','j_id2')) return false;A4J.AJAX.Submit(null,event,{'similarityGroupingId':'j_id2','parameters':{'j_id2':'j_id2'} ,'actionUrl':'/RichFaces3Sample002\x2DTabPanel/faces/index.xhtml;jsessionid=F723F500BF5759F0E4FA09C0E157D026'} ); return false; this.onclick = null;" style="position:relative; top:1px;;height : 100%; "> <tr> <td class="rich-tabhdr-side-border"> <img alt="" height="1" src="/RichFaces3Sample002-TabPanel/faces/a4j/g/3_3_3.Finalimages/spacer.gif" style="border:0" width="1" /> </td> <td class="rich-tabhdr-side-cell"> <table border="0" cellpadding="0" cellspacing="0" style="height: 100%; width: 100%;"> <tr> <td id="j_id2_lbl" onmouseover="RichFaces.overTab(this);" onmouseout="RichFaces.outTab(this);" class="rich-tab-header rich-tab-active "> タブ1</td> </tr> </table> </td> <td class="rich-tabhdr-side-border"> <img alt="" height="1" src="/RichFaces3Sample002-TabPanel/faces/a4j/g/3_3_3.Finalimages/spacer.gif" style="border:0" width="1" /> </td> </tr> </table> </td> <td> <img alt="" height="1" src="/RichFaces3Sample002-TabPanel/faces/a4j/g/3_3_3.Finalimages/spacer.gif" style="width: 1px; ;border:0" /> </td> <td id="j_id4_cell" style="height: 100%; vertical-align: bottom;" class="rich-tabhdr-cell-disabled"> <table border="0" cellpadding="0" cellspacing="0" id="j_id4_shifted" style="position:relative;;height : 100%; "> <tr> <td class="rich-tabhdr-side-border"> <img alt="" height="1" src="/RichFaces3Sample002-TabPanel/faces/a4j/g/3_3_3.Finalimages/spacer.gif" style="border:0" width="1" /> </td> <td class="rich-tabhdr-side-cell"> <table border="0" cellpadding="0" cellspacing="0" style="height: 100%; width: 100%;"> <tr> <td id="j_id4_lbl" class="rich-tab-header rich-tab-disabled "> タブ2 </td> </tr> </table> </td> <td class="rich-tabhdr-side-border"> <img alt="" height="1" src="/RichFaces3Sample002-TabPanel/faces/a4j/g/3_3_3.Finalimages/spacer.gif" style="border:0" width="1" /> </td> </tr> </table> </td> <td> <img alt="" height="1" src="/RichFaces3Sample002-TabPanel/faces/a4j/g/3_3_3.Finalimages/spacer.gif" style="width: 1px; ;border:0" /> </td> <td id="j_id6_cell" style="height: 100%; vertical-align: bottom;" class="rich-tabhdr-cell-inactive"> <table border="0" cellpadding="0" cellspacing="0" id="j_id6_shifted" onclick="if (RichFaces.isTabActive('j_id6_lbl')) return false; if (!RichFaces.onTabChange(event, 'j_id1','j_id6')) return false;A4J.AJAX.Submit(null,event,{'similarityGroupingId':'j_id6','parameters':{'j_id6':'j_id6'} ,'actionUrl':'/RichFaces3Sample002\x2DTabPanel/faces/index.xhtml;jsessionid=F723F500BF5759F0E4FA09C0E157D026'} ); return false; this.onclick = null;" style="position:relative;;height : 100%; "> <tr> <td class="rich-tabhdr-side-border"> <img alt="" height="1" src="/RichFaces3Sample002-TabPanel/faces/a4j/g/3_3_3.Finalimages/spacer.gif" style="border:0" width="1" /> </td> <td class="rich-tabhdr-side-cell"> <table border="0" cellpadding="0" cellspacing="0" style="height: 100%; width: 100%;"> <tr> <td id="j_id6_lbl" onmouseover="RichFaces.overTab(this);" onmouseout="RichFaces.outTab(this);" class="rich-tab-header rich-tab-inactive "> タブ3 </td> </tr> </table> </td> <td class="rich-tabhdr-side-border"> <img alt="" height="1" src="/RichFaces3Sample002-TabPanel/faces/a4j/g/3_3_3.Finalimages/spacer.gif" style="border:0" width="1" /> </td> </tr> </table> </td> <td> <img alt="" height="1" src="/RichFaces3Sample002-TabPanel/faces/a4j/g/3_3_3.Finalimages/spacer.gif" style="width: 1px; ;border:0" /> </td> </tr> </table> <div style="display: none;"> <script type="text/javascript"> RichFaces.panelTabs['j_id1']=[{'name':'j_id2','inactiveClass':'rich\x2Dtab\x2Dheader rich\x2Dtab\x2Dinactive ','ontableave':'','cellInactiveClass':'rich\x2Dtabhdr\x2Dcell\x2Dinactive','ontabenter':'','activeClass':'rich\x2Dtab\x2Dheader rich\x2Dtab\x2Dactive ','id':'j_id2','cellActiveClass':'rich\x2Dtabhdr\x2Dcell\x2Dactive'} ,{'name':'j_id6','inactiveClass':'rich\x2Dtab\x2Dheader rich\x2Dtab\x2Dinactive ','ontableave':'','cellInactiveClass':'rich\x2Dtabhdr\x2Dcell\x2Dinactive','ontabenter':'','activeClass':'rich\x2Dtab\x2Dheader rich\x2Dtab\x2Dactive ','id':'j_id6','cellActiveClass':'rich\x2Dtabhdr\x2Dcell\x2Dactive'} ] ; </script> </div> <input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="j_id1" autocomplete="off" /> </form> </td> </tr> <tr> <td id="j_id2" style=";height:100%"> <table border="0" cellpadding="10" cellspacing="0" class="rich-tabpanel-content-position" width="100%"> <tr> <td class="rich-tabpanel-content " style="; "> タブ1の中身 </td> </tr> </table> </td> </tr> </tbody> </table> </body> </html>
以上です。
0 件のコメント:
コメントを投稿
注: コメントを投稿できるのは、このブログのメンバーだけです。