Raible's Wiki
Raible Designs AppFuseHomepage- Korean - Chinese - Italian - Japanese QuickStart Guide User Guide Tutorials Other ApplicationsStruts ResumeSecurity Example Struts Menu
Set your name in
UserPreferences
Referenced by
JSPWiki v2.2.33
Hide Menu |
This is version 1.
It is not the current version, and thus it cannot be edited. This page documents the steps necessary to migrate an existing JSF application for use as a Jetspeed portlet. See the installing Jetspeed page if you don't have Jetspeed installed. The application used for testing and figuring out these steps was the JSF version of Equinox. The jsf-demo app that's included in Jetspeed-2 was used as a reference. For this tutorial, Equinox 1.2 was used - and this change was made to build.xml. To begin, I created an equinox-jsf project by downloading/extracting Equinox and then cd-ing into its extras/jsf folder and running "ant test". Make sure Tomcat is stopped when you run this command since this command will actually start Tomcat and run some tests in it. NOTE: This is a work-in-progress and is not complete.Table of Contents
Add the portals-bridges-jsf-0.1.jar to your project [#1]Once you have equinox-jsf and jetspeed setup, copy the portals-bridges-jsf-0.1.jar from your local Maven repository into the web/WEB-INF/lib directory. cp ~/.maven/repository/portals-bridges/jars/portals-bridges-myfaces-0.1.jar web/WEB-INF/lib Modify web.xml to use *.jsf instead of *.html [#2]After a bit of trial-and-error, I discovered that the *.html mapping didn't seem to work in web.xml. This is strange since it does work in the Struts Portlet. Change the mappings for the FacesServlet and exportFilter to be *.jsf.<filter-mapping> <filter-name>exportFilter</filter-name> <url-pattern>*.jsf</url-pattern> </filter-mapping> <servlet-mapping> <servlet-name>faces</servlet-name> <url-pattern>*.jsf</url-pattern> </servlet-mapping> Create a portlet.xml file in the WEB-INF directory [#3]Copy and paste the following XML into a portlet.xml file in the web/WEB-INF directory. <?xml version="1.0" encoding="UTF-8"?> <portlet-app id="equinox-jsf" version="1.0"> <portlet id="Equinox-JSF"> <init-param> <name>ViewPage</name> <value>/userList.jsf</value> </init-param> <portlet-name>Equinox-JSF</portlet-name> <display-name>Equinox</display-name> <description>This is a simple portlet</description> <portlet-class>org.apache.portals.bridges.myfaces.FacesPortlet</portlet-class> <expiration-cache>-1</expiration-cache> <supports> <mime-type>text/html</mime-type> <portlet-mode>VIEW</portlet-mode> <portlet-mode>EDIT</portlet-mode> <portlet-mode>HELP</portlet-mode> </supports> <portlet-info> <title>User List</title> <short-title>users</short-title> </portlet-info> </portlet> </portlet-app> Deploy the WAR to Jetspeed [#4]In build.properties, add a "deploy.dir" property so you can deploy to Jetspeed's deployer. deploy.dir=/opt/dev/tools/tomcat/webapps/jetspeed/WEB-INF/deploy Edit web/WEB-INF/classes/jdbc.properties and change the "jdbc.url" to use an absolute path. This is necessary so you can populate the HSQL database from the equinox-jsf directory. jdbc.url=jdbc:hsqldb:/Users/mraible/dev/equinox-jsf/db/equinox Start Tomcat and run "ant deploywar" to deploy your portlet. If you're watching Tomcat's log files ($CATALINA_HOME/logs/catalina.out) - and you don't see your WAR getting deployed, make sure the portlet.xml is in your web/WEB-INF directory. To update the WAR in Jetspeed, just run "ant deploywar" after you've modified files. To undeploy the WAR, delete the equinox-jsf.war file from $CATALINA_HOME/webapps/jetspeed/WEB-INF/deploy. NOTE: These deployment instructions are based on this wiki page.Create a .psml file so the portlet will show up in Jetspeed [#5]Create a equinox-jsf.psml file in $CATALINA_HOME/webapps/jetspeed/WEB-INF/pages with the following contents. The fragment id's must be unique among all .psml files, and the name of the portlet is read from the portlet.xml file.<?xml version="1.0" encoding="UTF-8"?> <page id="equinox-jsf"> <defaults skin="orange" layout-decorator="tigris" portlet-decorator="tigris"/> <title>Equinox-JSF</title> <fragment id="equinox-jsf-layout" type="layout" name="jetspeed::VelocityTwoColumns"> <fragment id="equinox-jsf-portlet" type="portlet" name="equinox-jsf::Equinox-JSF"> <property layout="TwoColumns" name="row" value="0"/> <property layout="TwoColumns" name="column" value="0"/> </fragment> </fragment> </page> Open http://localhost:8080/jetspeed. You should see a "Equinox-JSF" tab on the opening screen. To populate the values in the HSQL database, run "ant populate" and you should see a list of users when you click on the tab. Known Issues [#6]
|