Author: taylor
Date: Mon Jul 24 11:14:25 2006
New Revision: 425139

URL: http://svn.apache.org/viewvc?rev=425139&view=rev
Log:
documentation guides for velocity and jsf development provided by Philip Mark 
Donaghy
http://issues.apache.org/jira/browse/JS2-549
http://issues.apache.org/jira/browse/JS2-545

Added:
    portals/jetspeed-2/trunk/xdocs/guides/guide-simple-jsf-portlet.xml
    portals/jetspeed-2/trunk/xdocs/guides/guide-simple-velocity-portlet.xml
Modified:
    portals/jetspeed-2/trunk/xdocs/guides/index.xml

Added: portals/jetspeed-2/trunk/xdocs/guides/guide-simple-jsf-portlet.xml
URL: 
http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/xdocs/guides/guide-simple-jsf-portlet.xml?rev=425139&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/xdocs/guides/guide-simple-jsf-portlet.xml (added)
+++ portals/jetspeed-2/trunk/xdocs/guides/guide-simple-jsf-portlet.xml Mon Jul 
24 11:14:25 2006
@@ -0,0 +1,201 @@
+<?xml version="1.0"?>
+<!--
+       Copyright 2006 The Apache Software Foundation
+       
+       Licensed under the Apache License, Version 2.0 (the "License");
+       you may not use this file except in compliance with the License.
+       You may obtain a copy of the License at
+       
+       http://www.apache.org/licenses/LICENSE-2.0
+       
+       Unless required by applicable law or agreed to in writing, software
+       distributed under the License is distributed on an "AS IS" BASIS,
+       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+       See the License for the specific language governing permissions and
+       limitations under the License.
+-->
+<document>
+       <properties>
+               <title>Jetspeed Simple JSF Portlet Guide</title>
+               <subtitle>Documentation for Creating a Simple JSF 
Portlet</subtitle>
+               <authors>
+                       <person name="David Le Strat" email="[EMAIL PROTECTED]" 
/>
+                       <person name="Philip Mark Donaghy" email="[EMAIL 
PROTECTED]" />
+               </authors>
+       </properties>
+       <body>
+               <section name="Jetspeed Simple JSF Portlet Guide">
+                       <p>
+                               This guide provides a tutorial for creating a 
very
+                               simple JSF portlet with one template in the 
portlet view mode.
+                       </p>
+                       <subsection name="1. The Portlet Class">
+                               <p>
+                               Create the file JSFSimplest.java in a directory 
called
+                               jsf-simplest/WEB-INF/classes:
+                               <source>
+public class JSFSimplest extends org.apache.portals.bridges.jsf.FacesPortlet
+{
+
+    public void doView(javax.portlet.RenderRequest request, 
javax.portlet.RenderResponse response)
+                throws javax.portlet.PortletException, java.io.IOException
+    {
+        super.doView(request, response);
+    }
+}
+                               </source>
+                               </p>
+                               <p>
+                               Compile the class in the 
jsf-simplest/WEB-INF/classes directory using the command,
+                               <source>
+javac -cp 
portlet-api-1.0.jar:portals-bridges-jsf-1.0.jar:portals-bridges-common-1.0.jar 
JSFSimplest.java
+                               </source>
+                               </p>
+                       </subsection>
+                       <subsection name="2. The portlet.xml">
+                       <p>
+                       Create the file portlet.xml in the jsf-simplest/WEB-INF 
directory.
+                       <source><![CDATA[
+<?xml version="1.0" encoding="UTF-8"?>
+<portlet-app id="jsfsimplest" version="1.0">
+  <portlet id="JSFSimplest">
+    <portlet-name>JSFSimplestPortlet</portlet-name>
+    <display-name>JSF Simplest Display Name</display-name>
+    <portlet-class>JSFSimplest</portlet-class>
+    <init-param>
+        <name>ViewPage</name>
+        <value>/WEB-INF/view/view.jsp</value>
+    </init-param>
+    <supports>
+      <mime-type>text/html</mime-type>
+      <portlet-mode>VIEW</portlet-mode>
+    </supports>
+    <supported-locale>en</supported-locale>
+    <supported-locale>fr</supported-locale>
+    <portlet-info>
+      <title>JSF Simplest Title</title>
+      <short-title>JSF Simplest Short Title</short-title>
+    </portlet-info>
+  </portlet>
+</portlet-app>]]>
+                       </source>
+                       </p>
+                       </subsection>
+                       <subsection name="3. The web.xml">
+                       <p>
+                       Create the file web.xml in the jsf-simplest/WEB-INF 
directory.
+                       <source><![CDATA[
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 
2.3//EN"
+                         "http://java.sun.com/dtd/web-app_2_3.dtd";>
+<web-app>
+  <display-name>JSF Simplest</display-name>
+  <description>The world's simplest JSF portlet</description>
+
+  <!-- Faces Config -->
+  <context-param>
+    <param-name>javax.faces.application.CONFIG_FILES</param-name>
+    <param-value>/WEB-INF/faces-config.xml</param-value>
+  </context-param>
+
+  <!-- Faces Servlet -->
+  <servlet>
+    <servlet-name>Faces Servlet</servlet-name>
+    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+  </servlet>
+
+  <!-- Faces extension mapping -->
+  <servlet-mapping>
+    <servlet-name>Faces Servlet</servlet-name>
+    <url-pattern>*.jsf</url-pattern>
+  </servlet-mapping>
+</web-app>]]>
+                       </source>
+                       </p>
+                       </subsection>
+                       <subsection name="4. The View">
+                       <p>
+                        Create the view.jsp file in the 
jsf-simplest/WEB-INF/view directory.
+<source><![CDATA[
+<%@ taglib uri="http://java.sun.com/jsf/core"; prefix="f" %>
+<%@ taglib uri="/WEB-INF/tld/portlet.tld" prefix='portlet'%>
+<portlet:defineObjects/>
+<f:view>
+   <h2>A JSF Portlet</h2>
+   Hello
+   <% if ( renderRequest.getUserPrincipal() == null ) { %>
+   guest
+   <% } else { %>
+   <%=renderRequest.getUserPrincipal().getName()%>
+   <% } %>!
+</f:view>]]>
+</source>
+                       </p>
+                       </subsection>
+                       <subsection name="5. The faces-config.xml">
+                       <p>
+                        Create a faces-config.xml file in the 
jsf-simplest/WEB-INF directory.
+<source><![CDATA[
+<?xml version='1.0' encoding='UTF-8'?>
+<!DOCTYPE faces-config PUBLIC
+  "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
+  "http://java.sun.com/dtd/web-facesconfig_1_1.dtd";>
+
+<faces-config>
+
+  <application>
+    <locale-config>
+      <default-locale>en</default-locale>
+      <supported-locale>fr</supported-locale>
+    </locale-config>
+  </application>
+
+</faces-config>]]>
+</source>
+                       </p>
+                       </subsection>
+                       <subsection name="6. The Dependency JARs">
+                       <p>
+                        Copy the dependencies to the WEB-INF/lib directory. 
+                        These jars should be in your Maven repository. If so 
executing these commands in the lib
+                        directory will set up the dependencies for you.
+<source>
+ln -s ~/.maven/repository/commons-beanutils/jars/commons-beanutils-1.7.0.jar
+ln -s ~/.maven/repository/commons-collections/jars/commons-collections-3.1.jar
+ln -s ~/.maven/repository/commons-digester/jars/commons-digester-1.7.jar
+ln -s ~/.maven/repository/myfaces/jars/myfaces-api-1.1.0.jar
+ln -s ~/.maven/repository/myfaces/jars/myfaces-impl-1.1.0.jar
+ln -s ~/.maven/repository/myfaces/jars/tomahawk-1.1.0.jar
+ln -s 
~/.maven/repository/org.apache.portals.bridges/jars/portals-bridges-jsf-1.0.jar
+ln -s ~/.maven/repository/xerces/jars/xerces-2.4.0.jar
+ln -s ~/.maven/repository/xml-apis/jars/xml-apis-2.0.2.jar
+</source>
+                       </p>
+                       </subsection>
+                       <subsection name="7. The WAR file">
+                       <p>
+                       From the directory jsf-simplest combine the files above 
into a war file using the command,
+                       <source>
+jar cvf ../jsfsimplest.war .
+                       </source>
+                       </p>
+                       </subsection>
+                       <subsection name="8. Deploy the WAR file">
+                       <p>
+                       Copy the war file to 
<code>$CATALINA_HOME/webapps/jetspeed/WEB-INF/deploy</code>.
+                        Jetspeed-2 will deploy the webapp.
+                       </p>
+                       </subsection>
+                       <subsection name="9. The PSML">
+                       <p>
+                        Create the PSML page using the Jetspeed portlet 
chooser. Login and click on the
+                        edit page icon. Click on the add portlet icon.
+                        Checkbox and add the JSFSimplestPortlet to your page.
+                        Your user must have the permission to edit pages. The 
user <code>admin</code>
+                        password
+                        <code>admin</code> has permission to edit all pages.
+                       </p>
+                       </subsection>
+               </section>
+       </body>
+</document>

Added: portals/jetspeed-2/trunk/xdocs/guides/guide-simple-velocity-portlet.xml
URL: 
http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/xdocs/guides/guide-simple-velocity-portlet.xml?rev=425139&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/xdocs/guides/guide-simple-velocity-portlet.xml 
(added)
+++ portals/jetspeed-2/trunk/xdocs/guides/guide-simple-velocity-portlet.xml Mon 
Jul 24 11:14:25 2006
@@ -0,0 +1,174 @@
+<?xml version="1.0"?>
+<!--
+       Copyright 2006 The Apache Software Foundation
+       
+       Licensed under the Apache License, Version 2.0 (the "License");
+       you may not use this file except in compliance with the License.
+       You may obtain a copy of the License at
+       
+       http://www.apache.org/licenses/LICENSE-2.0
+       
+       Unless required by applicable law or agreed to in writing, software
+       distributed under the License is distributed on an "AS IS" BASIS,
+       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+       See the License for the specific language governing permissions and
+       limitations under the License.
+-->
+<document>
+       <properties>
+               <title>Jetspeed Simple Velocity Portlet Guide</title>
+               <subtitle>Documentation for Creating a Simple Velocity 
Portlet</subtitle>
+               <authors>
+                       <person name="David Le Strat" email="[EMAIL PROTECTED]" 
/>
+                       <person name="Philip Mark Donaghy" email="[EMAIL 
PROTECTED]" />
+               </authors>
+       </properties>
+       <body>
+               <section name="Jetspeed Simple Velocity Portlet Guide">
+                       <p>
+                               This guide provides a tutorial for creating a 
very
+                               simple Velocity portlet with one template in 
the portlet view mode.
+                       </p>
+                       <subsection name="1. The Portlet Class">
+                               <p>
+                               Create the file VelocitySimplest.java in a 
directory called
+                               velocity-simplest/WEB-INF/classes:
+                               <source>
+public class VelocitySimplest extends 
org.apache.portals.bridges.velocity.GenericVelocityPortlet
+{
+
+    public void doView(javax.portlet.RenderRequest request, 
javax.portlet.RenderResponse response)
+                throws javax.portlet.PortletException, java.io.IOException
+    {
+        super.doView(request, response);
+    }
+}
+                               </source>
+                               </p>
+                               <p>
+                               Compile the class in the 
velocity-simplest/WEB-INF/classes directory using the command,
+                               <source>
+javac -cp 
portlet-api-1.0.jar:portals-bridges-velocity-1.0.jar:portals-bridges-common-1.0.jar
 VelocitySimplest.java
+                               </source>
+                               </p>
+                       </subsection>
+                       <subsection name="2. The portlet.xml">
+                       <p>
+                       Create the file portlet.xml in the 
velocity-simplest/WEB-INF directory.
+                       <source><![CDATA[
+<?xml version="1.0" encoding="UTF-8"?>
+<portlet-app id="velocitysimplest" version="1.0">
+  <portlet id="VelocitySimplest">
+    <portlet-name>VelocitySimplest</portlet-name>
+    <display-name>Velocity Simplest Display Name</display-name>
+    <portlet-class>VelocitySimplest</portlet-class>
+    <init-param>
+        <name>ViewPage</name>
+        <value>/WEB-INF/view/world.vm</value>
+    </init-param>
+    <supports>
+      <mime-type>text/html</mime-type>
+      <portlet-mode>VIEW</portlet-mode>
+    </supports>
+    <supported-locale>en</supported-locale>
+    <portlet-info>
+      <title>Velocity Simplest Title</title>
+      <short-title>Velocity Simplest Short Title</short-title>
+    </portlet-info>
+  </portlet>
+</portlet-app>]]>
+                       </source>
+                       </p>
+                       </subsection>
+                       <subsection name="3. The web.xml">
+                       <p>
+                       Create the file web.xml in the 
velocity-simplest/WEB-INF directory.
+                       <source><![CDATA[
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 
2.3//EN"
+                         "http://java.sun.com/dtd/web-app_2_3.dtd";>
+<web-app>
+  <display-name>Velocity Simplest</display-name>
+  <description>The world's simplest Velocity portlet</description>
+
+  <!-- Define Velocity Servlet -->
+  <servlet>
+    <servlet-name>velocity</servlet-name>
+    
<servlet-class>org.apache.portals.bridges.velocity.BridgesVelocityViewServlet</servlet-class>
+  </servlet>
+
+  <!-- Map *.vm files to Velocity  -->
+  <servlet-mapping>
+    <servlet-name>velocity</servlet-name>
+    <url-pattern>*.vm</url-pattern>
+  </servlet-mapping>
+
+</web-app>]]>
+                       </source>
+                       </p>
+                       </subsection>
+                       <subsection name="4. The View">
+                       <p>
+                        Create the world.vm file in the 
velocity-simplest/WEB-INF/view directory. Put
+                        whatever content
+                        you desire in it. Notice that the template file is 
defined in the portlet init
+                        parameter <code>
+                        ViewPage</code>. The objects <a 
href="http://portals.apache.org/pluto/multiproject/portlet-api/apidocs/javax/portlet/PortletConfig.html";>PortletConfig</a>,
 <a 
href="http://portals.apache.org/pluto/multiproject/portlet-api/apidocs/javax/portlet/RenderRequest.html";>RenderRequest</a>,
 and <a 
href="http://portals.apache.org/pluto/multiproject/portlet-api/apidocs/javax/portlet/RenderResponse.html";>RenderResponse</a>
+                        are automatically
+                        placed in the Velocity context for use in Velocity 
templates. Here is a sample
+                        template showing a few of these objects methods and 
properties.
+<source>
+$portletConfig.portletName
+$portletConfig.portletContext.serverInfo
+#set ($MESSAGES = $portletConfig.getResourceBundle($renderRequest.Locale))
+$renderRequest.portletMode
+$renderResponse.namespace
+</source>
+                       </p>
+                       </subsection>
+                       <subsection name="5. The Dependency JARs">
+                       <p>
+                        Copy the commons-beanutils-1.7.0.jar, 
commons-collections-3.1.jar,
+                        commons-digester-1.7.jar, 
portals-bridges-velocity-1.0.jar,
+                        velocity-1.4.jar, and velocity-tools-1.1.jar to the 
velocity-simplest/WEB-INF/lib
+                        directory. IMPORTANT: 
+                        Do NOT put the portlet-api-1.0.jar in the war file. If 
you have already built
+                        Jetspeed these
+                        jars should be in your Maven repository. If so 
executing these commands in the lib
+                        directory will set up the dependencies for you.
+<source>
+ln -s ~/.maven/repository/commons-beanutils/jars/commons-beanutils-1.7.0.jar
+ln -s ~/.maven/repository/commons-collections/jars/commons-collections-3.1.jar
+ln -s ~/.maven/repository/commons-digester/jars/commons-digester-1.7.jar
+ln -s 
~/.maven/repository/org.apache.portals.bridges/jars/portals-bridges-velocity-1.0.jar
+ln -s ~/.maven/repository/velocity/jars/velocity-1.4.jar
+ln -s ~/.maven/repository/velocity-tools/jars/velocity-tools-1.1.jar
+</source>
+                       </p>
+                       </subsection>
+                       <subsection name="6. The WAR file">
+                       <p>
+                       From the directory velocity-simplest combine the files 
above into a war file using the command,
+                       <source>
+jar cvf ../velocitysimplest.war .
+                       </source>
+                       </p>
+                       </subsection>
+                       <subsection name="7. Deploy the WAR file">
+                       <p>
+                       Copy the war file to 
<code>$CATALINA_HOME/webapps/jetspeed/WEB-INF/deploy</code>.
+                        Jetspeed-2 will deploy the webapp.
+                       </p>
+                       </subsection>
+                       <subsection name="8. The PSML">
+                       <p>
+                        Create the PSML page using the Jetspeed portlet 
chooser. Login and click on the
+                        edit page icon.
+                        Your user must have the permission to edit pages. The 
user <code>admin</code>
+                        password
+                        <code>admin</code> has permission to edit all pages.
+                       </p>
+                       </subsection>
+               </section>
+       </body>
+</document>

Modified: portals/jetspeed-2/trunk/xdocs/guides/index.xml
URL: 
http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/xdocs/guides/index.xml?rev=425139&r1=425138&r2=425139&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/xdocs/guides/index.xml (original)
+++ portals/jetspeed-2/trunk/xdocs/guides/index.xml Mon Jul 24 11:14:25 2006
@@ -61,6 +61,8 @@
                        <li><a href="guide-l10n.html">Guide to localization 
with Jetspeed-2</a></li>
                        <li><a href="guide-ajax-api.html">Guide to Jetspeed-2 
AJAX API</a></li>
                        <li><a href="guide-simple-portlet.html">Guide to a very 
simple portlet with Jetspeed-2</a></li>
+                       <li><a href="guide-simple-velocity-portlet.html">Guide 
to a very simple velocity portlet with Jetspeed-2</a></li>
+                       <li><a href="guide-simple-jsf-portlet.html">Guide to a 
very simple jsf portlet with Jetspeed-2</a></li>
                        <li><a href="guide-portlet-bridges.html">Guide to 
portlet bridges</a></li>                              
                </ul>
                </subsection>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to