{"id":3813,"date":"2011-12-27T13:44:05","date_gmt":"2011-12-27T18:44:05","guid":{"rendered":"http:\/\/jianmingli.com\/wp\/?p=3813"},"modified":"2012-03-08T12:22:06","modified_gmt":"2012-03-08T17:22:06","slug":"apache-myfaces-trinidad-2-0-eclipse-indigo-tomcat-7","status":"publish","type":"post","link":"https:\/\/jianmingli.com\/wp\/?p=3813","title":{"rendered":"Apache MyFaces Trinidad 2.0 with Eclipse Indigo and Tomcat 7"},"content":{"rendered":"<div class='toc wptoc'>\n<h2>Contents<\/h2>\n<ol class='toc-odd level-1'>\n\t<li>\n\t\t<a href=\"#Setup_Trinidad_Project_in_Eclipse_Indigo\">Setup Trinidad Project in Eclipse Indigo<\/a>\n\t\t<ol class='toc-even level-2'>\n\t\t\t<li>\n\t\t\t\t<a href=\"#Download_and_Install_Eclipse_Indigo\">Download and Install Eclipse Indigo<\/a>\n\t\t\t<\/li>\n\t\t\t<li>\n\t\t\t\t<a href=\"#Download_and_unzip_Apache_MyFaces_2.0\">Download and unzip Apache MyFaces 2.0<\/a>\n\t\t\t<\/li>\n\t\t\t<li>\n\t\t\t\t<a href=\"#Download_and_unzip_MyFaces_Trinidad_2.0\">Download and unzip MyFaces Trinidad 2.0<\/a>\n\t\t\t<\/li>\n\t\t\t<li>\n\t\t\t\t<a href=\"#Setup_User_Libraries\">Setup User Libraries<\/a>\n\t\t\t<\/li>\n\t\t\t<li>\n\t\t\t\t<a href=\"#Create_JSF_2.0_Project\">Create JSF 2.0 Project<\/a>\n\t\t\t<\/li>\n\t\t<\/ol>\n\t<li>\n\t\t<a href=\"#Configuration\">Configuration<\/a>\n\t\t<ol class='toc-even level-2'>\n\t\t\t<li>\n\t\t\t\t<a href=\"#WEB-INFtrinidad-config.xml\">WEB-INF\/trinidad-config.xml<\/a>\n\t\t\t<\/li>\n\t\t\t<li>\n\t\t\t\t<a href=\"#WEB-INFfaces-config.xml\">WEB-INF\/faces-config.xml<\/a>\n\t\t\t<\/li>\n\t\t\t<li>\n\t\t\t\t<a href=\"#WEB-INFweb.xml\">WEB-INF\/web.xml<\/a>\n\t\t\t<\/li>\n\t\t\t<li>\n\t\t\t\t<a href=\"#Setup_Web_Content_Folder_Structure\">Setup Web Content Folder Structure<\/a>\n\t\t\t<\/li>\n\t\t<\/ol>\n\t<li>\n\t\t<a href=\"#Example\">Example<\/a>\n\t\t<ol class='toc-even level-2'>\n\t\t\t<li>\n\t\t\t\t<a href=\"#Template_File\">Template File<\/a>\n\t\t\t<\/li>\n\t\t\t<li>\n\t\t\t\t<a href=\"#Snippet_Files\">Snippet Files<\/a>\n\t\t\t<\/li>\n\t\t\t<li>\n\t\t\t\t<a href=\"#CSS_File\">CSS File<\/a>\n\t\t\t<\/li>\n\t\t\t<li>\n\t\t\t\t<a href=\"#Image_File\">Image File<\/a>\n\t\t\t<\/li>\n\t\t\t<li>\n\t\t\t\t<a href=\"#First_Page\">First Page<\/a>\n\t\t\t<\/li>\n\t\t\t<li>\n\t\t\t\t<a href=\"#User_Web_Page_Editor\">User Web Page Editor<\/a>\n\t\t\t<\/li>\n\t\t<\/ol>\n\t<li>\n\t\t<a href=\"#Deploy_to_Tomcat_7\">Deploy to Tomcat 7<\/a>\n\t\t<ol class='toc-even level-2'>\n\t\t\t<li>\n\t\t\t\t<a href=\"#Setup_Tomcat_7_in_Eclipse\">Setup Tomcat 7 in Eclipse<\/a>\n\t\t\t<\/li>\n\t\t\t<li>\n\t\t\t\t<a href=\"#Add_Project_to_Tomcat_7\">Add Project to Tomcat 7<\/a>\n\t\t\t<\/li>\n\t\t\t<li>\n\t\t\t\t<a href=\"#Deploy_to_Tomcat_7_1\">Deploy to Tomcat 7<\/a>\n\t\t\t<\/li>\n\t\t\t<li>\n\t\t\t\t<a href=\"#Test\">Test<\/a>\n\t\t\t<\/li>\n\t\t<\/ol>\n\t<li>\n\t\t<a href=\"#Issues\">Issues<\/a>\n\t\t<ol class='toc-even level-2'>\n\t\t\t<li>\n\t\t\t\t<a href=\"#JSF_commandButton_Does_not_Work\">JSF commandButton Does not Work<\/a>\n\t\t\t<\/li>\n\t\t\t<li>\n\t\t\t\t<a href=\"#The_server_does_not_support_version_3.0_of_the_J2EE_Web_module_specification\">The server does not support version 3.0 of the J2EE Web module specification<\/a>\n\t\t\t<\/li>\n\t\t<\/ol>\n\t<li>\n\t\t<a href=\"#Example_source_code\">Example source code<\/a>\n\t<\/li>\n\t<li>\n\t\t<a href=\"#References\">References<\/a>\n\t<\/li>\n<\/ol>\n<\/ol>\n<\/div>\n<div class='wptoc-end'>&nbsp;<\/div>\n<span id=\"Setup_Trinidad_Project_in_Eclipse_Indigo\"><h2>Setup Trinidad Project in Eclipse Indigo<\/h2><\/span>\n<span id=\"Download_and_Install_Eclipse_Indigo\"><h3>Download and Install Eclipse Indigo<\/h3><\/span>\n<p>* Download Eclipse Indigo from <a href=\"http:\/\/www.eclipse.org\/downloads\/\">Eclipse download site<\/a>. Make sure to download <strong>Eclipse IDE for Java EE Developers<\/strong>.<br \/>\n* Unzip.<\/p>\n<span id=\"Download_and_unzip_Apache_MyFaces_2.0\"><h3>Download and unzip Apache MyFaces 2.0<\/h3><\/span>\n<p>* This is needed for Tomcat and JEE5 app servers. You should not need this for JEE6 app servers.<br \/>\n* Download <a href=\"http:\/\/myfaces.apache.org\/download.html\">Apache MyFaces Core 2.0<\/a> from Apache MyFaces Core download site. For this post, I downloaded <a href=\"http:\/\/www.apache.org\/dyn\/closer.cgi\/myfaces\/binaries\/myfaces-core-assembly-2.0.11-bin.zip\">myfaces-core-assembly-2.0.11-bin.zip<\/a>.<br \/>\n* Unzip into a local directory, e.g. c:\\prog.<\/p>\n<span id=\"Download_and_unzip_MyFaces_Trinidad_2.0\"><h3>Download and unzip MyFaces Trinidad 2.0<\/h3><\/span>\n<p>* Download Trinidad 2.0 from <a href=\"http:\/\/myfaces.apache.org\/trinidad\/download.html\">Apache MyFaces Trinidad download site<\/a>. I downloaded <a href=\"http:\/\/www.apache.org\/dyn\/closer.cgi\/myfaces\/binaries\/trinidad-2.0.0-dist.zip\">trinidad-2.0.0-dist.zip<\/a>.<br \/>\n* Unzip into a local directory, e.g. c:\\prog.<\/p>\n<span id=\"Setup_User_Libraries\"><h3>Setup User Libraries<\/h3><\/span>\n<p>* Open <em>Window > Preferences > Java > Build Path > User Libraries<\/em><br \/>\n* Click <strong>New <\/strong>and enter user library name, i.e., <strong>MyFaces Trinidad 2.0.0<\/strong>. Click <strong>OK<\/strong>.<br \/>\n* Highlight the newly created user library, e.g. MyFaces Trinidad 2.0.0, and click <strong>ADD JARs<\/strong> button.<br \/>\n* Browse to Trinidad 2.0 lib directory, e.g. C:\\prog\\trinidad-assembly-2.0.0\\lib, and add both <strong>trinidad-api-2.0.0.jar<\/strong> and <strong>trinidad-impl-2.0.0.jar<\/strong> files.<br \/>\n* Similarly create a new user library named <strong>MyFaces Core 2.0.11<\/strong> and add all jar files <strong>except <\/strong>myfaces-bundle-2.0.11.jar from MyFaces 2.0 lib directory, e.g. C:\\prog\\myfaces-core-2.0.11-bin\\lib<\/p>\n<span id=\"\"><h6><a href=\"https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2011\/12\/eclipse_jsf2.myfaces2.trinidad2.userlib.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2011\/12\/eclipse_jsf2.myfaces2.trinidad2.userlib-300x154.jpg\" alt=\"\" title=\"eclipse_jsf2.myfaces2.trinidad2.userlib\" width=\"300\" height=\"154\" class=\"aligncenter size-medium wp-image-3873\" srcset=\"https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2011\/12\/eclipse_jsf2.myfaces2.trinidad2.userlib-300x154.jpg 300w, https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2011\/12\/eclipse_jsf2.myfaces2.trinidad2.userlib.jpg 747w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/h6><\/span>\n<span id=\"Create_JSF_2.0_Project\"><h3>Create JSF 2.0 Project<\/h3><\/span>\n<p>* Select <em>File > New > Dynamic Web Project<\/em><br \/>\n* Enter or select:<br \/>\n&#8211; Project name: <strong>jsf2.myfaces2.trinidad2.one<\/strong><br \/>\n&#8211; Target runtime: <strong>Apache Tomcat v7.0<\/strong><br \/>\n&#8211; Dynamic web module version: <strong>3.0<\/strong><br \/>\n&#8211; Configuration: <strong>JavaServer Faces v2.0 Project<\/strong><\/p>\n<span id=\"_1\"><h6><a href=\"https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2011\/12\/eclipse_jsf2.myfaces2.trinidad2.one_1.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2011\/12\/eclipse_jsf2.myfaces2.trinidad2.one_1-255x300.jpg\" alt=\"\" title=\"eclipse_jsf2.myfaces2.trinidad2.one_1\" width=\"255\" height=\"300\" class=\"aligncenter size-medium wp-image-3869\" srcset=\"https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2011\/12\/eclipse_jsf2.myfaces2.trinidad2.one_1-255x300.jpg 255w, https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2011\/12\/eclipse_jsf2.myfaces2.trinidad2.one_1.jpg 604w\" sizes=\"auto, (max-width: 255px) 100vw, 255px\" \/><\/a><\/h6><\/span>\n<span id=\"_2\"><h6><\/h6><\/span>\n<p>* Click <strong>Next <\/strong>three times<br \/>\n* Enter or select<br \/>\n&#8211; Type: <strong>User Library<\/strong> and check<br \/>\n&#8211; <strong>MyFaces Core 2.0.11<\/strong><br \/>\n&#8211; <strong>MyFaces Trinidad 2.0.0<\/strong><br \/>\n* Click <strong>Add&#8230;<\/strong> button to the right hand side of URL Mapping Patterns and enter <strong>*.jsf<\/strong><br \/>\n* Click <strong>OK <\/strong>and <strong>Finish<\/strong><\/p>\n<span id=\"_3\"><h6><a href=\"https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2011\/12\/eclipse_jsf2.myfaces2.trinidad2.one_createProj.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2011\/12\/eclipse_jsf2.myfaces2.trinidad2.one_createProj-254x300.jpg\" alt=\"\" title=\"eclipse_jsf2.myfaces2.trinidad2.one_createProj\" width=\"254\" height=\"300\" class=\"aligncenter size-medium wp-image-3876\" srcset=\"https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2011\/12\/eclipse_jsf2.myfaces2.trinidad2.one_createProj-254x300.jpg 254w, https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2011\/12\/eclipse_jsf2.myfaces2.trinidad2.one_createProj.jpg 602w\" sizes=\"auto, (max-width: 254px) 100vw, 254px\" \/><\/a><\/h6><\/span>\n<span id=\"Configuration\"><h2>Configuration<\/h2><\/span>\n<span id=\"WEB-INFtrinidad-config.xml\"><h3>WEB-INF\/trinidad-config.xml<\/h3><\/span>\n<p>* Create a new file named trinidad-config.xml in WEB-INF directory with the content:<\/p>\n<pre lang=\"xml\">\r\n<?xml version=\"1.0\"?>\r\n<trinidad-config xmlns=\"http:\/\/myfaces.apache.org\/trinidad\/config\">\r\n  <!-- Enable debug output -->\r\n  <debug-output>true<\/debug-output>\r\n  \r\n  <accessibility-mode>default<\/accessibility-mode>\r\n  \r\n  <skin-family>simple<\/skin-family>\r\n<\/trinidad-config>\r\n<\/pre>\n<span id=\"WEB-INFfaces-config.xml\"><h3>WEB-INF\/faces-config.xml<\/h3><\/span>\n<p>* Replace the content of faces-config.xml with content:<\/p>\n<pre lang=\"xml\">\r\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<faces-config\r\n    xmlns=\"http:\/\/java.sun.com\/xml\/ns\/javaee\"\r\n    xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\"\r\n    xsi:schemaLocation=\"http:\/\/java.sun.com\/xml\/ns\/javaee http:\/\/java.sun.com\/xml\/ns\/javaee\/web-facesconfig_2_0.xsd\"\r\n    version=\"2.0\">\r\n\r\n  <application>\r\n    <!-- Use the Trinidad RenderKit -->\r\n    <default-render-kit-id>\r\n      org.apache.myfaces.trinidad.core\r\n    <\/default-render-kit-id>\r\n  <\/application>\r\n\r\n<\/faces-config>\r\n<\/pre>\n<span id=\"WEB-INFweb.xml\"><h3>WEB-INF\/web.xml<\/h3><\/span>\n<p>* Replace web.xml with following content:<\/p>\n<pre lang=\"xml\">\r\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<web-app xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\" \r\n\txmlns=\"http:\/\/java.sun.com\/xml\/ns\/javaee\" \r\n\txmlns:web=\"http:\/\/java.sun.com\/xml\/ns\/javaee\/web-app_2_5.xsd\" \r\n         xsi:schemaLocation=\"http:\/\/java.sun.com\/xml\/ns\/javaee http:\/\/java.sun.com\/xml\/ns\/javaee\/web-app_2_5.xsd\"\r\n         version=\"2.5\">\r\n  <display-name>jsf2.myfaces2.trinidad2.one<\/display-name>\r\n\r\n  <!--\r\n      =================\r\n      JSF Settings\r\n      =================\r\n   -->\r\n  <!-- Faces Servlet -->\r\n  <servlet>\r\n    <servlet-name>Faces Servlet<\/servlet-name>\r\n    <servlet-class>javax.faces.webapp.FacesServlet<\/servlet-class>\r\n    <load-on-startup>1<\/load-on-startup>\r\n  <\/servlet>\r\n\r\n  <!-- Faces Servlet Mappings -->\r\n  <servlet-mapping>\r\n    <servlet-name>Faces Servlet<\/servlet-name>\r\n    <url-pattern>\/faces\/*<\/url-pattern>\r\n    <url-pattern>*.jsf<\/url-pattern>\r\n  <\/servlet-mapping>\r\n\r\n  <!-- resource loader servlet -->\r\n  <servlet>\r\n    <servlet-name>resources<\/servlet-name>\r\n    <servlet-class>org.apache.myfaces.trinidad.webapp.ResourceServlet<\/servlet-class>\r\n  <\/servlet>\r\n\r\n  <!-- \r\n     Important: \r\n         You must include this adf mapping even though you are not using ADF features.\r\n         Without this mapping, JSF navigation will fail!\r\n  -->\r\n  <servlet-mapping>\r\n    <servlet-name>resources<\/servlet-name>\r\n    <url-pattern>\/adf\/*<\/url-pattern>\r\n  <\/servlet-mapping>\r\n\r\n  <!-- setting the project stage to be DEVELOPMENT -->\r\n  <context-param>\r\n    <param-name>javax.faces.PROJECT_STAGE<\/param-name>   \r\n    <param-value>Development<\/param-value>\r\n  <\/context-param>\r\n\r\n  <!-- Use client-side state saving.  In Trinidad, it is an\r\n       optimized, token-based mechanism that is almost always a\r\n       better choice than the standard JSF server-side state saving. -->\r\n  <context-param>\r\n    <param-name>javax.faces.STATE_SAVING_METHOD<\/param-name>\r\n    <param-value>client<\/param-value>\r\n    <!--param-value>server<\/param-value-->\r\n  <\/context-param>\r\n\r\n  <!-- Trinidad by default uses an optimized client-side state saving\r\n       mechanism. To disable that, uncomment the following -->\r\n  <!--context-param>\r\n    <param-name>org.apache.myfaces.trinidad.CLIENT_STATE_METHOD<\/param-name>\r\n    <param-value>all<\/param-value>\r\n  <\/context-param-->\r\n\r\n  <!--\r\n      =================\r\n      Trinidad Settings\r\n      =================\r\n   -->\r\n  <!-- Trinidad also supports an optimized strategy for caching some\r\n   view state at an application level, which significantly improves\r\n   scalability.  However, it makes it harder to develop (updates to\r\n   pages will not be noticed until the server is restarted), and in\r\n   some rare cases cannot be used for some pages (see Trinidad\r\n   documentation for more information) -->\r\n  <context-param>\r\n    <param-name>org.apache.myfaces.trinidad.USE_APPLICATION_VIEW_CACHE<\/param-name>\r\n    <param-value>false<\/param-value>\r\n  <\/context-param>\r\n\r\n  <!-- If this parameter is enabled, Trinidad will automatically\r\n       check the modification date of your JSPs, and discard saved\r\n       state when they change;  this makes development easier,\r\n       but adds overhead that should be avoided when your application\r\n       is deployed -->\r\n  <context-param>\r\n    <param-name>org.apache.myfaces.trinidad.CHECK_FILE_MODIFICATION<\/param-name>\r\n    <param-value>true<\/param-value>\r\n  <\/context-param>\r\n\r\n  <!-- Enables Change Persistence at a session scope.  By default,\r\n       Change Persistence is entirely disabled. The ChangeManager is\r\n       an API, which can persist component modifications (like,\r\n       is a showDetail or tree expanded or collapsed). For providing\r\n       a custom Change Persistence implementation inherit from the \r\n       Trinidad API's ChangeManager class. As the value you have \r\n       to use the fullqualified class name. -->\r\n  <context-param>\r\n    <param-name>org.apache.myfaces.trinidad.CHANGE_PERSISTENCE<\/param-name>\r\n    <param-value>session<\/param-value>\r\n  <\/context-param>\r\n\r\n  <filter>\r\n    <filter-name>trinidad<\/filter-name>\r\n    <filter-class>org.apache.myfaces.trinidad.webapp.TrinidadFilter<\/filter-class>\r\n  <\/filter>\r\n\r\n  <filter-mapping>\r\n    <filter-name>trinidad<\/filter-name>\r\n    <servlet-name>faces<\/servlet-name>\r\n  <\/filter-mapping>\r\n\r\n<\/web-app>\r\n<\/pre>\n<span id=\"Setup_Web_Content_Folder_Structure\"><h3>Setup Web Content Folder Structure<\/h3><\/span>\n<p>Create the following folder structure under WebContent:<br \/>\n* <strong>resources<\/strong>: for static resources such as style sheets, images, JavaScript files<br \/>\n&#8211; <strong>css<\/strong>: for style sheet files. Use <\/p>\n<pre lang=\"xml\"><h:outputStylesheet name=\"style1.css\" library=\"css\"\/><\/pre>\n<p> to access them.<br \/>\n&#8211; <strong>images<\/strong>: for image files<br \/>\n&#8211; <strong>js<\/strong>: for JavaScript files.<br \/>\n* <strong>snippets<\/strong>: for facelet ui:composition files to be included in actual pages<br \/>\n* <strong>templates<\/strong>: for page templates<\/p>\n<span id=\"_4\"><h6><a href=\"https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2011\/12\/eclipse_jsf2.myfaces2.trinidad2.one_WebContentFolders.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2011\/12\/eclipse_jsf2.myfaces2.trinidad2.one_WebContentFolders-300x250.jpg\" alt=\"\" title=\"eclipse_jsf2.myfaces2.trinidad2.one_WebContentFolders\" width=\"300\" height=\"250\" class=\"aligncenter size-medium wp-image-3877\" srcset=\"https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2011\/12\/eclipse_jsf2.myfaces2.trinidad2.one_WebContentFolders-300x250.jpg 300w, https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2011\/12\/eclipse_jsf2.myfaces2.trinidad2.one_WebContentFolders.jpg 358w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/h6><\/span>\n<span id=\"Example\"><h2>Example<\/h2><\/span>\n<span id=\"Template_File\"><h3>Template File<\/h3><\/span>\n<p>* WebContent\/templates\/template1.xhtml:<\/p>\n<pre lang=\"xml\">\r\n<!DOCTYPE html PUBLIC \"-\/\/W3C\/\/DTD XHTML 1.0 Transitional\/\/EN\" \r\n          \"http:\/\/www.w3.org\/TR\/xhtml1\/DTD\/xhtml1-transitional.dtd\">\r\n<html xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\"\r\n      xmlns:h=\"http:\/\/java.sun.com\/jsf\/html\"\r\n      xmlns:ui=\"http:\/\/java.sun.com\/jsf\/facelets\">\r\n<h:head>\r\n\t<title><ui:insert name=\"title\">Place Page Title Here<\/ui:insert><\/title>\r\n\t<h:outputStylesheet name=\"style1.css\" library=\"css\"\/>\r\n<\/h:head>\r\n\r\n<h:body>\r\n\r\n\t<ui:insert name=\"menu\">Place Menu Here<\/ui:insert>\r\n\t\r\n\t<hr\/>\r\n\t<p\/>\r\n\t\r\n\t<ui:insert name=\"body\">Place Body Content Here<\/ui:insert>\r\n\t\r\n\t<hr\/>\r\n\t<p\/>\r\n\t\r\n\t<ui:insert name=\"footer\">\r\n\t\r\n\t<hr\/>\r\n\t\r\n\t<table width=\"100%\" class=\"linkTable\">\r\n\t\t<tr>\r\n\t\t  <th>Privacy Statement<\/th><th>Legal Disclaimer<\/th><th>Related Companies<\/th>\r\n\t\t<\/tr>\r\n\t<\/table>\r\n\t<\/ui:insert>\r\n\r\n<\/h:body>\r\n<\/html>\r\n<\/pre>\n<span id=\"Snippet_Files\"><h3>Snippet Files<\/h3><\/span>\n<p>* WebContent\/snippets\/menu1.xhtml:<\/p>\n<pre lang=\"xml\">\r\n<ui:composition xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\"\r\n\txmlns:ui=\"http:\/\/java.sun.com\/jsf\/facelets\">\r\n\t<table width=\"100%\" class=\"linkTable\">\r\n\t\t<tr>\r\n\t\t  <th>Menu1<\/th><th>Menu2<\/th><th>Menu3<\/th>\r\n\t\t<\/tr>\r\n\t<\/table>\r\n<\/ui:composition>\r\n<\/pre>\n<span id=\"CSS_File\"><h3>CSS File<\/h3><\/span>\n<p>* WebContent\/resources\/css\/style1.css:<\/p>\n<pre lang=\"xml\">\r\nbody {\r\n\tbackground-color: #FDF5E6;\r\n\ttext-align: center;\r\n}\r\n\r\na:hover {\r\n\tcolor: red\r\n}\r\n\r\nh2 {\r\n\tcolor: #440000;\r\n\ttext-align: center;\r\n\tfont-family: Arial, Helvetica, sans-serif\r\n}\r\n\r\nth.title {\r\n\tbackground-color: #EF8429;\r\n\tfont-size: 28px;\r\n\tfont-family: Arial, Helvetica, sans-serif;\r\n}\r\n\r\n.linkTable {\r\n\tbackground-color: black;\r\n\tcolor: white;\r\n}\r\n<\/pre>\n<span id=\"Image_File\"><h3>Image File<\/h3><\/span>\n<p>* WebContent\/resources\/images\/image1.jpg<br \/>\n* WebContent\/resources\/images\/image2.jpg<\/p>\n<span id=\"First_Page\"><h3>First Page<\/h3><\/span>\n<p>* WebContent\/page1.xhtml:<\/p>\n<pre lang=\"xml\">\r\n<ui:composition xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\"\r\n\txmlns:ui=\"http:\/\/java.sun.com\/jsf\/facelets\"\r\n\ttemplate=\"\/templates\/template1.xhtml\"\r\n\txmlns:tr=\"http:\/\/myfaces.apache.org\/trinidad\"\r\n\txmlns:h=\"http:\/\/java.sun.com\/jsf\/html\">\r\n\r\n\t<ui:define name=\"title\">\r\n    \tPage Title for Page 1\r\n\t<\/ui:define>\r\n\r\n\t<ui:define name=\"menu\">\r\n\t\t<ui:include src=\"\/snippets\/menu1.xhtml\" \/>\r\n\t<\/ui:define>\r\n\r\n\t<ui:define name=\"body\">\r\n\t\t<span id=\"Page_One\"><h2>Page One<\/h2><\/span>\r\n\t\t<p>\r\n\t\t\tThis is a Trinidad picture:<br \/>\r\n\t\t\t<tr:image source=\"\/resources\/images\/image1.jpg\"\/>\r\n\r\n\t\t\t<br \/><br \/>\r\n\t\t\tThis is another Trinidad image:<br \/>\r\n\t\t\t<h:graphicImage name=\"image2.jpg\" library=\"images\"\/>\r\n\t\t<\/p>\r\n\r\n\t<\/ui:define>\r\n\r\n\t<!-- We could override default footer as defined by template here:\r\n\t<ui:define name=\"footer\">\r\n\t\t<ui:include src=\"\/snippets\/footer1.xhtml\"\/>\r\n\t<\/ui:define>\t  \r\n\t-->\r\n<\/ui:composition>\r\n\r\n<\/pre>\n<span id=\"User_Web_Page_Editor\"><h3>User Web Page Editor<\/h3><\/span>\n<p>* Right click <strong>page1.xhtml<\/strong> and select <em>Open With > Web Page Editor<\/em><br \/>\n* Select <em>Window > Show View > Others > General > Palette<\/em> to see Trinidad tags<\/p>\n<span id=\"_5\"><h6><a href=\"https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2011\/12\/eclipse_jsf2.myfaces2.trinidad2.one_palette.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2011\/12\/eclipse_jsf2.myfaces2.trinidad2.one_palette-191x300.jpg\" alt=\"\" title=\"eclipse_jsf2.myfaces2.trinidad2.one_palette\" width=\"191\" height=\"300\" class=\"aligncenter size-medium wp-image-3878\" srcset=\"https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2011\/12\/eclipse_jsf2.myfaces2.trinidad2.one_palette-191x300.jpg 191w, https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2011\/12\/eclipse_jsf2.myfaces2.trinidad2.one_palette.jpg 286w\" sizes=\"auto, (max-width: 191px) 100vw, 191px\" \/><\/a><\/h6><\/span>\n<span id=\"Deploy_to_Tomcat_7\"><h2>Deploy to Tomcat 7<\/h2><\/span>\n<span id=\"Setup_Tomcat_7_in_Eclipse\"><h3>Setup Tomcat 7 in Eclipse<\/h3><\/span>\n<p>* Click <em>Window > Show View > Servers<\/em> to open the Servers window<br \/>\n* Right click within the Servers window and select <em>New > Server<\/em><br \/>\n* Select or enter:<br \/>\n&#8211; Server type: Tomcat v7.0 Server<br \/>\n&#8211; Server&#8217;s host name: localhost<br \/>\n&#8211; Server name: Tomcat v7.0 Server at localhost<br \/>\n&#8211; Server runtime environment: Apache Tomcat v7.0<\/p>\n<span id=\"_6\"><h6><a href=\"https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2011\/12\/eclipse_svr_tomcat7.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2011\/12\/eclipse_svr_tomcat7-265x300.jpg\" alt=\"\" title=\"eclipse_svr_tomcat7\" width=\"265\" height=\"300\" class=\"aligncenter size-medium wp-image-3887\" srcset=\"https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2011\/12\/eclipse_svr_tomcat7-265x300.jpg 265w, https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2011\/12\/eclipse_svr_tomcat7.jpg 531w\" sizes=\"auto, (max-width: 265px) 100vw, 265px\" \/><\/a><\/h6><\/span>\n<span id=\"Add_Project_to_Tomcat_7\"><h3>Add Project to Tomcat 7<\/h3><\/span>\n<p>* Open Servers window and right click Tomcat 7 server<br \/>\n* Select <em>Add and Remove&#8230;<\/em><br \/>\n* Move the project from <em>Available <\/em>to <em>Configured<\/em><\/p>\n<span id=\"_7\"><h6><a href=\"https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2011\/12\/eclipse_svr_add_proj.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2011\/12\/eclipse_svr_add_proj-300x281.jpg\" alt=\"\" title=\"eclipse_svr_add_proj\" width=\"300\" height=\"281\" class=\"aligncenter size-medium wp-image-3888\" srcset=\"https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2011\/12\/eclipse_svr_add_proj-300x281.jpg 300w, https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2011\/12\/eclipse_svr_add_proj.jpg 581w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/h6><\/span>\n<span id=\"Deploy_to_Tomcat_7_1\"><h3>Deploy to Tomcat 7<\/h3><\/span>\n<p>* Right click the Tomcat server and select <em>Start <\/em>or <em>Restart<\/em>. The project will be deployed.<br \/>\n* Once the server is started, saving project resources such as pages will cause the project to be automatically redeployed.<\/p>\n<span id=\"Test\"><h3>Test<\/h3><\/span>\n<p>* Point browser to: <a href=\"http:\/\/localhost:8080\/jsf2.myfaces2.trinidad2.one\/page1.jsf\">http:\/\/localhost:8080\/jsf2.myfaces2.trinidad2.one\/page1.jsf<\/a><\/p>\n<span id=\"_8\"><h6><a href=\"https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2011\/12\/eclipse_jsf2.myfaces2.trinidad2.one_page1.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2011\/12\/eclipse_jsf2.myfaces2.trinidad2.one_page1-300x139.jpg\" alt=\"\" title=\"eclipse_jsf2.myfaces2.trinidad2.one_page1\" width=\"300\" height=\"139\" class=\"aligncenter size-medium wp-image-3882\" srcset=\"https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2011\/12\/eclipse_jsf2.myfaces2.trinidad2.one_page1-300x139.jpg 300w, https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2011\/12\/eclipse_jsf2.myfaces2.trinidad2.one_page1-1024x476.jpg 1024w, https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2011\/12\/eclipse_jsf2.myfaces2.trinidad2.one_page1.jpg 1349w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/h6><\/span>\n<span id=\"Issues\"><h2>Issues<\/h2><\/span>\n<span id=\"JSF_commandButton_Does_not_Work\"><h3>JSF commandButton Does not Work<\/h3><\/span>\n<p>Cause:<br \/>\n* Managed bean method never gets called.<br \/>\nReason:<br \/>\n* In our case, this is caused because the resource servlet and <em>mapping <\/em>are missing from the web.xml file. You can repeat the issue just by changing the<em> \/adf\/*<\/em> mapping to <em>\/adf<strong>2<\/strong>\/*<\/em><br \/>\nFix:<br \/>\n* The fix is to add the mapping to web.xml file.<\/p>\n<pre lang=\"xml\">\r\n  <!-- resource loader servlet -->\r\n  <servlet>\r\n    <servlet-name>resources<\/servlet-name>\r\n    <servlet-class>org.apache.myfaces.trinidad.webapp.ResourceServlet<\/servlet-class>\r\n  <\/servlet>\r\n\r\n  <!-- \r\n     Important: \r\n         You must include this adf mapping even though you are not using ADF features.\r\n         Without this mapping, JSF navigation will fail!\r\n  -->\r\n  <servlet-mapping>\r\n    <servlet-name>resources<\/servlet-name>\r\n    <url-pattern>\/adf\/*<\/url-pattern>\r\n  <\/servlet-mapping>\r\n<\/pre>\n<span id=\"The_server_does_not_support_version_3.0_of_the_J2EE_Web_module_specification\"><h3>The server does not support version 3.0 of the J2EE Web module specification<\/h3><\/span>\n<p>* When you try to add a dynamic web project to a server instance, e.g. Tomcat 6, if you get this error message, you can edit the <em>jsf2.myfaces2.trinidad2.one\\.settings\\org.eclipse.wst.common.project.facet.core.xml<\/em> file and change<\/p>\n<pre lang=\"xml\">\r\n  <installed facet=\"jst.web\" version=\"3.0\"\/>\r\n<\/pre>\n<p>to<\/p>\n<pre lang=\"xml\">\r\n  <installed facet=\"jst.web\" version=\"2.5\"\/>\r\n<\/pre>\n<p>* Refresh the Eclipse project for the change to take effect<\/p>\n<span id=\"Example_source_code\"><h2>Example source code<\/h2><\/span>\n<p>* <a href='https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2011\/12\/jsf2.myfaces2.trinidad2.one_1.zip'>jsf2.myfaces2.trinidad2.one<\/a><\/p>\n<span id=\"References\"><h2>References<\/h2><\/span>\n<p>* <a href=\"http:\/\/www.vogella.de\/articles\/ApacheMyFaces\/ar01s02.html\">Example JSF application with Apache MyFaces Trinidad<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Setup Trinidad Project in Eclipse Indigo Download and Install Eclipse Indigo * Download Eclipse Indigo from Eclipse download site. Make sure to download Eclipse IDE for Java EE Developers. * Unzip. Download and unzip Apache MyFaces 2.0 * This is &hellip; <a href=\"https:\/\/jianmingli.com\/wp\/?p=3813\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[122,120],"tags":[],"class_list":["post-3813","post","type-post","status-publish","format-standard","hentry","category-eclipse","category-jsf"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8cRUO-Zv","_links":{"self":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/3813","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3813"}],"version-history":[{"count":33,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/3813\/revisions"}],"predecessor-version":[{"id":4478,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/3813\/revisions\/4478"}],"wp:attachment":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3813"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3813"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3813"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}