[gatein-commits] gatein SVN: r9104 - epp/docs/branches/6.0/Developer_Guide/en-US.
do-not-reply at jboss.org
do-not-reply at jboss.org
Wed Jan 30 23:39:22 EST 2013
Author: jaredmorgs
Date: 2013-01-30 23:39:21 -0500 (Wed, 30 Jan 2013)
New Revision: 9104
Modified:
epp/docs/branches/6.0/Developer_Guide/en-US/Revision_History.xml
epp/docs/branches/6.0/Developer_Guide/en-US/chapter-5-GDG_Application_development.xml
epp/docs/branches/6.0/Developer_Guide/en-US/chapter-6-GDG_JavaScript_Development.xml
Log:
Changes incorporated for https://docs.jboss.org/author/display/GTNPORTAL35/Custom+Internationalization+Resource+Bundles
Modified: epp/docs/branches/6.0/Developer_Guide/en-US/Revision_History.xml
===================================================================
--- epp/docs/branches/6.0/Developer_Guide/en-US/Revision_History.xml 2013-01-31 02:44:30 UTC (rev 9103)
+++ epp/docs/branches/6.0/Developer_Guide/en-US/Revision_History.xml 2013-01-31 04:39:21 UTC (rev 9104)
@@ -5,7 +5,7 @@
<simpara>
<revhistory>
<revision>
- <revnumber>6.0.0-8</revnumber>
+ <revnumber>6.0.0-9</revnumber>
<date>Thu Jan 31 2013</date>
<author>
<firstname>Jared</firstname>
Modified: epp/docs/branches/6.0/Developer_Guide/en-US/chapter-5-GDG_Application_development.xml
===================================================================
--- epp/docs/branches/6.0/Developer_Guide/en-US/chapter-5-GDG_Application_development.xml 2013-01-31 02:44:30 UTC (rev 9103)
+++ epp/docs/branches/6.0/Developer_Guide/en-US/chapter-5-GDG_Application_development.xml 2013-01-31 04:39:21 UTC (rev 9104)
@@ -30,28 +30,25 @@
<section id="sid-819805">
<title>Portlet Development</title>
<para>
- JBoss Portal Platform's interface is fully customizable with applications called portlets. Application development can be done by using the plain Portlet specification JSR286 (refer to the "Portlet Primer" chapter in the JBoss Portal Platform <citetitle>Reference Guide</citetitle> for more information), but it is also possible to use the JBoss Portlet Bridge to write applications with JavaServerFaces (JSF), RichFaces or Seam (refer to the "Getting started with JBoss Portlet Bridge" chapter of the JBoss Portal Platform <citetitle>Reference Guide)</citetitle>.
+ JBoss Portal Platform's interface is fully customizable with applications called portlets. Application development can be done by using the plain Portlet specification JSR286 (refer to the "Portlet Primer" chapter in the JBoss Portal Platform <citetitle>Reference Guide</citetitle> for more information), but it is also possible to use the JBoss Portlet Bridge to write applications with JavaServerFaces (JSF), RichFaces or Seam (refer to the "Getting started with JBoss Portlet Bridge" chapter of the JBoss Portal Platform <citetitle>Reference Guide)</citetitle>.
</para>
<para>
Whichever technology you choose, refer to <link linkend="sid-55378991">Starting a Portlet Project</link> to learn how to set up your project in a robust and effective way using the JBoss Portal Platform Bill of Materials (BOM).
</para>
- <section id="sid-55378991">
-
- <title>Starting a Portlet Project</title>
- <section id="sid-55378991_StartingaPortletProject-TheBOMConcept">
-
- <title>The BOM Concept</title>
- <para>
+ <section id="sid-55378991">
+ <title>Starting a Portlet Project</title>
+ <section id="sid-55378991_StartingaPortletProject-TheBOMConcept">
+ <title>The BOM Concept</title>
+ <para>
To make the management of dependencies easier, JBoss Portal Platform Team has prepared the Bill of Materials (BOM) needed for developing typical portlet applications. BOM is a Maven <code>pom.xml</code> file which specifies the versions, types and scopes of dependencies which are granted to be compatible with (or indeed in many cases provided by) JBoss Portal Platform.
</para>
- </section>
- <section id="sid-55378991_StartingaPortletProject-HowtoUseBOM">
-
- <title>How to Use JBoss Portal Platform BOM</title>
- <para>
+ </section>
+ <section id="sid-55378991_StartingaPortletProject-HowtoUseBOM">
+ <title>How to Use JBoss Portal Platform BOM</title>
+ <para>
Let us look at the <code>pom.xml</code> file from Simplest Hello World Portket example below, which contains all necessary details.
</para>
- <para>
+ <para>
In its <code><dependencyManagement></code> section, it declares
<code><dependency></code>
<code>gatein-3.5-bom</code>
@@ -60,11 +57,11 @@
<code>import</code>
. It indicates that the dependency will <emphasis role="italics">de facto</emphasis> be replaced with the dependencies in its <code>dependencyManagement</code> section. Due to this fact, in the <code><dependencies></code> section of the Simplest Hello World <code>pom.xml</code>, we can declare the <code>javax.portlet:portlet-api</code> dependency without specifying its <code><version></code>, <code><type></code> or <code><scope></code>. All those details are managed by <code>gatein-3.5-bom</code>.
</para>
- <example>
- <title>Simplest Hello World Portlet</title>
- <programlisting language="XML">
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <example>
+ <title>Simplest Hello World Portlet</title>
+ <programlisting language="XML">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>simplest-hello-world-portlet</artifactId>
@@ -148,24 +145,22 @@
</project>
</programlisting>
- </example>
- <para>
+ </example>
+ <para>
Further steps, after you have set up the <code>pom.xml</code> file for your project, depend on the technology you have chosen for writing portlets.
</para>
- </section>
</section>
- <section id="sid-55477012">
-
- <title>Standard Portlet Development (JSR286)</title>
- <section id="sid-55477012_StandardPortletDevelopmentJSR286-TheJavaPart">
-
- <title>The Java Part</title>
- <para>
- After setting up the the Maven <code>pom.xml</code> file as shown in the previous section, we can continue with implementing a basic JSR286 compatible portlet. Simplest Hello World Portlet from the JBoss Portal Platform <link linkend="sid-55378941">Quickstarts</link> collection shows the very essence of every JSR286 Portlet:
+ </section>
+ <section id="sid-55477012">
+ <title>Standard Portlet Development (JSR286)</title>
+ <section id="sid-55477012_StandardPortletDevelopmentJSR286-TheJavaPart">
+ <title>The Java Part</title>
+ <para>
+ After setting up the the Maven <code>pom.xml</code> file as shown in the previous section, we can continue with implementing a basic JSR286 compatible portlet. An example of such a portlet is contained in the JBoss Portal Platform Quickstart "Simplest Hello World Portlet"
</para>
- <example>
- <title>SimplestHelloWorldPortlet.java</title>
- <programlisting language="Java">
+ <example>
+ <title>SimplestHelloWorldPortlet.java</title>
+ <programlisting language="Java">
package org.jboss.portal.portlet.samples;
import java.io.IOException;
@@ -182,55 +177,54 @@
*/
public class SimplestHelloWorldPortlet extends GenericPortlet {
/**
- * Serves the VIEW mode. Writes "Hello World !" to the response writer.
+ * Serves the VIEW mode. Writes "Hello World !" to the response writer.
*
* @see javax.portlet.GenericPortlet#doView(javax.portlet.RenderRequest, javax.portlet.RenderResponse)
*/
@Override
public void doView(RenderRequest request, RenderResponse response) throws IOException {
PrintWriter writer = response.getWriter();
- writer.write("Hello World !");
+ writer.write("Hello World !");
writer.close();
}
}
</programlisting>
- </example>
- <para>As you can see in the listing, we have done two important things:</para>
- <itemizedlist>
- <listitem>
- <para>
+ </example>
+ <para>As you can see in the listing, we have done two important things:</para>
+ <itemizedlist>
+ <listitem>
+ <para>
We extended
<code>javax.portlet.GenericPortlet</code>
from
<code>javax.portlet:portlet-api</code>
artifact.
</para>
- </listitem>
- <listitem>
- <para>
+ </listitem>
+ <listitem>
+ <para>
We have overriden the
<code>doView()</code>
method.
</para>
- </listitem>
- </itemizedlist>
- <para>
+ </listitem>
+ </itemizedlist>
+ <para>
In this simplest portlet variant, EDIT and HELP portlet modes are not supported. To add them, override the <code>doEdit()</code> and <code>doHelp</code> from <code>javax.portlet.GenericPortlet</code> and configure the <code>portlet.xml</code> file accordingly.
</para>
- </section>
- <section id="sid-55477012_StandardPortletDevelopmentJSR286-portlet.xml">
-
- <title>portlet.xml</title>
- <para>
+ </section>
+ <section id="sid-55477012_StandardPortletDevelopmentJSR286-portlet.xml">
+ <title>portlet.xml</title>
+ <para>
The
<code>portlet.xml</code>
file for a plain JSR286 portlet is as follows:
</para>
- <example>
- <title>portlet.xml</title>
- <programlisting language="XML">
-<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" version="2.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd">
+ <example>
+ <title>portlet.xml</title>
+ <programlisting language="XML">
+<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" version="2.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd">
<portlet>
<description>Simplest Hello World Portlet is the very essence of every possible Portlet.</description>
<portlet-name>SimplestHelloWorldPortlet</portlet-name>
@@ -250,33 +244,31 @@
</portlet>
</portlet-app>
</programlisting>
- </example>
- </section>
- <section id="sid-55477012_StandardPortletDevelopmentJSR286-web.xml">
-
- <title>web.xml</title>
- <para>
+ </example>
+ </section>
+ <section id="sid-55477012_StandardPortletDevelopmentJSR286-web.xml">
+ <title>web.xml</title>
+ <para>
There is no need to configure filters, servlets or mapping for a plain JSR286 portlet to work but maven-war-plugin by default requires the
<code>web.xml</code>. To solve it, include a <code>web.xml</code> file which contains solely the root element:
</para>
- <example>
- <title>web.xml</title>
- <programlisting language="XML">
-<web-app 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-app_2_5.xsd"
- version="2.5">
+ <example>
+ <title>web.xml</title>
+ <programlisting language="XML">
+<web-app 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-app_2_5.xsd"
+ version="2.5">
<!--
There is no need to configure any filters, servlets, mapping & co. for this demo to work
but maven-war-plugin by default requires this file.
-->
</web-app>
</programlisting>
- </example>
- </section>
- <section id="sid-55477012_StandardPortletDevelopmentJSR286-FurtherSteps">
-
- <title>Further Steps</title>
- <para>
+ </example>
+ </section>
+ <section id="sid-55477012_StandardPortletDevelopmentJSR286-FurtherSteps">
+ <title>Further Steps</title>
+ <para>
After having done all the above, it is time to
<link linkend="sid-55379158">build and deploy the portlet</link>
,
@@ -285,53 +277,48 @@
<ulink url="https://docs.jboss.org/author/pages/viewpage.action?pageId=54264655">add it to a page</ulink>
so that you can test its functionality.
</para>
- </section>
- <section id="sid-55477012_StandardPortletDevelopmentJSR286-Seealso">
-
- <title>See also</title>
- <itemizedlist>
- <listitem>
- <para>
+ </section>
+ <section id="sid-55477012_StandardPortletDevelopmentJSR286-Seealso">
+ <title>See also</title>
+ <itemizedlist>
+ <listitem>
+ <para>
<ulink url="https://docs.jboss.org/author/pages/viewpage.action?pageId=54264602">Portlet Primer</ulink>
</para>
- </listitem>
- <listitem>
- <para>
+ </listitem>
+ <listitem>
+ <para>
<ulink url="http://jcp.org/en/jsr/detail?id=286">JSR286</ulink>
</para>
- </listitem>
- </itemizedlist>
- </section>
+ </listitem>
+ </itemizedlist>
</section>
- <section id="sid-55477014">
-
- <title>JSF2 Portlet Development</title>
- <para>
+ </section>
+ <section id="sid-55477014">
+ <title>JSF2 Portlet Development</title>
+ <para>
The Portlet Bridge pre-installed in JBoss Portal Platform allows for implementing portlets with JavaServer Faces (JSF) 2.1 and RichFaces (RF) 4.2.3. As RichFaces is a component library for JavaServer Faces, the guidelines for using both of them are very similar. More precisely, the setup for a JavaServer Faces portlet project is a superset of a RichFaces project setup. In accordance with that, you need to read both
<xref linkend="sid-55477016"/>
and
<xref linkend="sid-55477018"/>
when developing with RichFaces.
</para>
- <section id="sid-55477016">
-
- <title>Basic JSF Portlet Development</title>
- <para>JSF stands for JavaServer Pages. The JSF version delivered by the built-in Portlet Bridge is 2.1.</para>
- <section id="sid-55477016_BasicJSFPortletDevelopment-ExampleCode">
-
- <title>Example Code</title>
+ <section id="sid-55477016">
+ <title>Basic JSF Portlet Development</title>
+ <para>JSF stands for JavaServer Pages. The JSF version delivered by the built-in Portlet Bridge is 2.1.</para>
+ <section id="sid-55477016_BasicJSFPortletDevelopment-ExampleCode">
+ <title>Example Code</title>
+ <para>
+ This section mentions code from the JSF2 Hello World Portlet example in the JBoss Portal Platform Quickstarts, available for download from <ulink url="https://access.redhat.com/"/> as part of your JBoss Portal Platform subscription.
+ </para>
+ <section id="sid-55477016_BasicJSFPortletDevelopment-pom.xml">
+ <title>pom.xml</title>
<para>
- This section cites code from JSF2 Hello World Portlet from the <link linkend="sid-55378941">JBoss Portal Platform Quickstarts</link> collection.
- </para>
- <section id="sid-55477016_BasicJSFPortletDevelopment-pom.xml">
-
- <title>pom.xml</title>
- <para>
There is only one noticeable difference in <filename>pom.xml</filename> against what we have shown as a general case in the <link linkend="sid-55378991">Starting a Portlet Project</link> section. The dependencies are different for JSF:
</para>
- <example>
- <title>pom.xml</title>
- <programlisting language="XML">
+ <example>
+ <title>pom.xml</title>
+ <programlisting language="XML">
<dependencies>
<!--
The versions, scopes and types of these dependencies are managed in gatein-*-bom.
@@ -349,20 +336,19 @@
</dependency>
</dependencies>
</programlisting>
- </example>
- </section>
- <section id="sid-55477016_BasicJSFPortletDevelopment-JSFTemplateFiles">
-
- <title>JSF Template Files</title>
- <para>
+ </example>
+ </section>
+ <section id="sid-55477016_BasicJSFPortletDevelopment-JSFTemplateFiles">
+ <title>JSF Template Files</title>
+ <para>
In the following listing you can see the beginning of a typical JSF portlet template. It is taken from
<code>main.xhtml</code>
file located in
<code>src/main/webapp/pages</code>
directory.
</para>
- <para>Code Snippet error: Read timed out.</para>
- <para>
+ <para>Code Snippet error: Read timed out.</para>
+ <para>
Note that
<code><f:view></code>
as a root element of the portlet template above prevents an erroneous
@@ -375,7 +361,7 @@
<code><h:body></code>
elements are always needed for JSF Facelets to work.
</para>
- <para>
+ <para>
The following listing shows the use of several JSF elements, such as
<code><h:outputLabel></code>
,
@@ -386,27 +372,26 @@
<code><h:form></code>
.
</para>
- <para>Code Snippet error: Read timed out.</para>
- <para>
+ <para>Code Snippet error: Read timed out.</para>
+ <para>
The complete source code of the above template can be found in
<code>src/main/webapp/pages/main.xhtml</code>
of JSF2 Hello World Portlet project.
</para>
- </section>
- <section id="sid-55477016_BasicJSFPortletDevelopment-JavaBeans">
-
- <title>Java Beans</title>
- <para>
+ </section>
+ <section id="sid-55477016_BasicJSFPortletDevelopment-JavaBeans">
+ <title>Java Beans</title>
+ <para>
In the JSF template file shown above, we refer to
<code>helloBean</code>
. This bean is implemented in Java as follows:
</para>
- <informalexample>
- <programlisting language="Java">
+ <informalexample>
+ <programlisting language="Java">
/**
* {@link HelloBean} is the JSF backing bean for the application, holding the input data to be re-displayed.
*/
- @ManagedBean(name = "helloBean")
+ @ManagedBean(name = "helloBean")
@SessionScoped
public class HelloBean implements Serializable {
@@ -418,11 +403,11 @@
private String name;
/**
- * Initializes {@link #name} with the value {@code "World"}.
+ * Initializes {@link #name} with the value {@code "World"}.
*/
@PostConstruct
public void postContruct() {
- this.name = "World";
+ this.name = "World";
}
/**
@@ -444,18 +429,18 @@
}
/**
- * Resets {@link #name} to the default value {@code "World"}.
+ * Resets {@link #name} to the default value {@code "World"}.
*
* @param ae ignored
*/
public void reset(ActionEvent ae) {
- this.name = "World";
+ this.name = "World";
}
}
</programlisting>
- </informalexample>
- <para>
+ </informalexample>
+ <para>
The
<code>@ManagedBean</code>
and
@@ -464,18 +449,17 @@
<code>faces-config.xml</code>
file.
</para>
- </section>
- <section id="sid-55477016_BasicJSFPortletDevelopment-portlet.xml">
-
+ </section>
+ <section id="sid-55477016_BasicJSFPortletDevelopment-portlet.xml">
+ <title>portlet.xml</title>
+ <para>portlet.xml is the place where we tie the JSF templates with the portlet.</para>
+ <example>
<title>portlet.xml</title>
- <para>portlet.xml is the place where we tie the JSF templates with the portlet.</para>
- <example>
- <title>portlet.xml</title>
- <programlisting language="XML">
-<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" version="2.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd
- http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd">
+ <programlisting language="XML">
+<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" version="2.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd
+ http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd">
<portlet>
<description>A simple JSF2 portlet.</description>
<portlet-name>jsf2HelloWorldPortlet</portlet-name>
@@ -516,8 +500,8 @@
</programlisting>
- </example>
- <para>
+ </example>
+ <para>
Note that the
<code>javax.portlet.faces.defaultViewId.*</code>
<code>init-params</code>
@@ -527,20 +511,19 @@
<code><portlet-class></code>
will serve the purpose for most JSF portlets.
</para>
- </section>
- <section id="sid-55477016_BasicJSFPortletDevelopment-web.xml">
-
- <title>web.xml</title>
- <para>
+ </section>
+ <section id="sid-55477016_BasicJSFPortletDevelopment-web.xml">
+ <title>web.xml</title>
+ <para>
JSF portlets require a few tweaks in the
<code>web.xml</code>
file:
</para>
- <example>
- <title>web.xml</title>
- <programlisting language="XML">
-<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" version="2.5">
+ <example>
+ <title>web.xml</title>
+ <programlisting language="XML">
+<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" version="2.5">
<display-name>jsf2-hello-world-portlet</display-name>
<context-param>
<description>See https://docs.jboss.org/author/display/PBR/Render+Policy</description>
@@ -573,14 +556,13 @@
</servlet-mapping>
</web-app>
</programlisting>
- </example>
- </section>
- <section id="sid-55477016_BasicJSFPortletDevelopment-CustomCSS">
-
- <title>Custom CSS</title>
- <para>
- Portlet Bridge supports loading of CSS resources in the "JSF way". Use the
- <code><h:outputStylesheet library="css" name="jsf2-hello-world-portlet.css" /></code>
+ </example>
+ </section>
+ <section id="sid-55477016_BasicJSFPortletDevelopment-CustomCSS">
+ <title>Custom CSS</title>
+ <para>
+ Portlet Bridge supports loading of CSS resources in the "JSF way". Use the
+ <code><h:outputStylesheet library="css" name="jsf2-hello-world-portlet.css" /></code>
as in the
<code>main.xhtml</code>
file above. The
@@ -589,32 +571,32 @@
<code>resources/css</code>
folder of the web application.
</para>
- <para>
+ <para>
Note that relative paths like
- <code>url('css/background/jsf-logo.png')</code>
+ <code>url('css/background/jsf-logo.png')</code>
do not work when used in CSS loaded via
<code><h:outputStylesheet ...></code>
. Rather a JSF Expression Language expression
- <code>#{resource['/css/background/jsf-logo.png']</code>
+ <code>#{resource['/css/background/jsf-logo.png']</code>
} needs to be used. This expression is dynamically evaluated to a proper public URL. The path
- <code>'/css/background/jsf-logo.png'</code>
+ <code>'/css/background/jsf-logo.png'</code>
used in the expression is relative to
<code>resources</code>
folder of the web application. See also
<ulink url="https://docs.jboss.org/author/pages/viewpage.action?pageId=51806374">Resource Serving</ulink>
.
</para>
- <example>
- <title>jsf2-hello-world-portlet.css</title>
- <programlisting>
+ <example>
+ <title>jsf2-hello-world-portlet.css</title>
+ <programlisting>
div.jsf2HelloWorldPortlet {
padding: 10px;
/* In the following we use a JSF Expression Language expression rather then plain relative path.
- Plain relative paths do not work in JSF portlets. The expression #{resource['...']} is
- dynamically evaluated to a proper public URL. The path '/css/background/jsf-logo.png'
+ Plain relative paths do not work in JSF portlets. The expression #{resource['...']} is
+ dynamically evaluated to a proper public URL. The path '/css/background/jsf-logo.png'
used in the expression is relative to resources folder of this web application.
See https://docs.jboss.org/author/display/PBR/Resource+Serving */
- background: url(#{resource['/css/background/jsf-logo.png']}) no-repeat;
+ background: url(#{resource['/css/background/jsf-logo.png']}) no-repeat;
background-position-x: 753px;
background-position-y: 10px;
}
@@ -622,12 +604,11 @@
width: 713px;
}
</programlisting>
- </example>
- </section>
- <section id="sid-55477016_BasicJSFPortletDevelopment-Internationalization">
-
- <title>Internationalization</title>
- <para>
+ </example>
+ </section>
+ <section id="sid-55477016_BasicJSFPortletDevelopment-Internationalization">
+ <title>Internationalization</title>
+ <para>
Internationalization is supported via standard Java Resource bundles. In our example project the
<code>*.property</code>
files of
@@ -638,11 +619,11 @@
<filename>faces-config.xml</filename>
are needed so that this bundle can be used in JSF templates.
</para>
- <example>
- <title>faces-config.xml</title>
- <programlisting language="XML">
-<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_2_0.xsd" version="2.0">
+ <example>
+ <title>faces-config.xml</title>
+ <programlisting language="XML">
+<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_2_0.xsd" version="2.0">
<application>
<!-- Declare the internationalization resources -->
<resource-bundle>
@@ -657,20 +638,19 @@
</application>
</faces-config>
</programlisting>
- </example>
- <para>
+ </example>
+ <para>
Note that in the above faces-config.xml, we have made our bundle visible in JSF templates under the variable
<code>msgs</code>
. Its individual entries can then be accessed using the usual Expression Language dot notation: e.g.
<code>#{msgs.Name</code>
}.
</para>
- </section>
</section>
- <section id="sid-55477016_BasicJSFPortletDevelopment-FurtherSteps">
-
- <title>Further Steps</title>
- <para>
+ </section>
+ <section id="sid-55477016_BasicJSFPortletDevelopment-FurtherSteps">
+ <title>Further Steps</title>
+ <para>
After having done all the above, it is time to
<link linkend="sid-55379158">build and deploy the portlet</link>
,
@@ -679,42 +659,36 @@
<ulink url="https://docs.jboss.org/author/pages/viewpage.action?pageId=54264655">add it to a page</ulink>
so that you can test its functionality.
</para>
- </section>
- <section id="sid-55477016_BasicJSFPortletDevelopment-Seealso">
-
- <title>See also</title>
- <itemizedlist>
- <listitem>
- <para>
+ </section>
+ <section id="sid-55477016_BasicJSFPortletDevelopment-Seealso">
+ <title>See also</title>
+ <itemizedlist>
+ <listitem>
+ <para>
<ulink url="https://docs.jboss.org/author/pages/viewpage.action?pageId=54264602">Portlet Primer</ulink>
</para>
- </listitem>
- </itemizedlist>
- </section>
+ </listitem>
+ </itemizedlist>
</section>
- <section id="sid-55477018">
-
- <title>JSF Portlet Development with RichFaces</title>
- <para>
+ </section>
+ <section id="sid-55477018">
+ <title>JSF Portlet Development with RichFaces</title>
+ <para>
As we have already noted, RichFaces (RF) is just a component library for JavaServer Faces (JSF). Therefore, everything said in the
<xref linkend="sid-55477016"/>
chapter applies here too.
</para>
- <section id="sid-55477018_JSFPortletDevelopmentwithRichFaces-ExampleCode">
-
- <title>Example Code</title>
- <para>
- This section cites code from JSF2+RF4 Hello World Portlet from the
- <link linkend="sid-55378941">JBoss Portal Platform Quickstarts</link>
- collection.
- </para>
- <section id="sid-55477018_JSFPortletDevelopmentwithRichFaces-pom.xml">
-
+ <section id="sid-55477018_JSFPortletDevelopmentwithRichFaces-ExampleCode">
+ <title>Example Code</title>
+ <para>
+ This section mentions code from the JSF2+RF4 Hello World Portlet example in the JBoss Portal Platform Quickstarts, available for download from <ulink url="https://access.redhat.com/"/> as part of your JBoss Portal Platform subscription.
+ </para>
+ <section id="sid-55477018_JSFPortletDevelopmentwithRichFaces-pom.xml">
+ <title>pom.xml</title>
+ <para>We need to add several RF-specific dependencies to the general JSF ones:</para>
+ <example>
<title>pom.xml</title>
- <para>We need to add several RF-specific dependencies to the general JSF ones:</para>
- <example>
- <title>pom.xml</title>
- <programlisting language="XML">
+ <programlisting language="XML">
<dependencies>
<!--
The versions, scopes and types of these dependencies are managed in gatein-*-bom.
@@ -751,71 +725,69 @@
</dependency>
</dependencies>
</programlisting>
- </example>
- </section>
- <section id="sid-55477018_JSFPortletDevelopmentwithRichFaces-JSFTemplateFiles">
-
- <title>JSF Template Files</title>
- <para>
+ </example>
+ </section>
+ <section id="sid-55477018_JSFPortletDevelopmentwithRichFaces-JSFTemplateFiles">
+ <title>JSF Template Files</title>
+ <para>
We use
<code><rich:*></code>
components in the templates:
</para>
- <example>
- <title>Form with rich: components in main.xhtml</title>
- <programlisting language="XML">
+ <example>
+ <title>Form with rich: components in main.xhtml</title>
+ <programlisting language="XML">
</p>
- <h:form id="jsf2HelloWorldPortlet">
- <h:panelGrid columns="2">
- <h:outputLabel value="#{msgs.Greeting}" for="greeting"/>
- <rich:select id="greeting" value="#{helloBean.greeting}">
- <f:selectItems value="#{helloBean.greetings}" />
- <f:ajax render="output" event="selectitem"/>
+ <h:form id="jsf2HelloWorldPortlet">
+ <h:panelGrid columns="2">
+ <h:outputLabel value="#{msgs.Greeting}" for="greeting"/>
+ <rich:select id="greeting" value="#{helloBean.greeting}">
+ <f:selectItems value="#{helloBean.greetings}" />
+ <f:ajax render="output" event="selectitem"/>
</rich:select>
- <h:outputLabel value="#{msgs.Name}" for="nameInput"/>
- <h:inputText id="nameInput" value="#{helloBean.name}">
- <f:validateLength minimum="1" maximum="50" />
- <f:ajax render="output" event="keyup"/>
+ <h:outputLabel value="#{msgs.Name}" for="nameInput"/>
+ <h:inputText id="nameInput" value="#{helloBean.name}">
+ <f:validateLength minimum="1" maximum="50" />
+ <f:ajax render="output" event="keyup"/>
</h:inputText>
</h:panelGrid>
<p>
- <h:panelGroup id="output">
- <strong><h:outputText value="#{helloBean.greeting} #{helloBean.name}!" rendered="#{not empty helloBean.name}"/></strong>
+ <h:panelGroup id="output">
+ <strong><h:outputText value="#{helloBean.greeting} #{helloBean.name}!" rendered="#{not empty helloBean.name}"/></strong>
</h:panelGroup>
</p>
<p>
- <h:commandButton id="reset" value="#{msgs.Reset}" actionListener="#{helloBean.reset}">
- <f:ajax render="@form" />
+ <h:commandButton id="reset" value="#{msgs.Reset}" actionListener="#{helloBean.reset}">
+ <f:ajax render="@form" />
</h:commandButton> - #{msgs.ResetComment}
</p>
<p>
- <h:commandButton id="reload" value="#{msgs.Reload}" /> - #{msgs.ReloadComment}
+ <h:commandButton id="reload" value="#{msgs.Reload}" /> - #{msgs.ReloadComment}
</p>
</programlisting>
- </example>
- <para>The complete source code of the above template can be found in src/main/webapp/pages/main.xhtml of JSF2+RF4 Hello World Portlet quickstart.</para>
- </section>
- <section id="sid-55477018_JSFPortletDevelopmentwithRichFaces-JavaBeans">
-
- <title>Java Beans</title>
- <para>
+ </example>
+ <para>The complete source code of the above template can be found in src/main/webapp/pages/main.xhtml of JSF2+RF4 Hello World Portlet quickstart.</para>
+ </section>
+ <section id="sid-55477018_JSFPortletDevelopmentwithRichFaces-JavaBeans">
+ <title>Java Beans</title>
+ <para>
The HelloBean presented in the
<xref linkend="sid-55477016"/>
chapter was extended firstly to provide a list of greeting phrases selectable in the drop-down box on the main.xhtml page and secondly to be able to store the greeting phrase selected in the drop-down box.
</para>
- <example>
- <title>HelloBean.java</title>
- <programlisting language="Java">
+ <example>
+ <title>HelloBean.java</title>
+ <programlisting language="Java">
/**
- * Static list of greetings. Contains {@code "Hello"} and {@code "Hi"}.
+ * Static list of greetings. Contains {@code "Hello"} and {@code "Hi"}.
*/
private static final List<SelectItem> GREETINGS;
static {
List<SelectItem> l = new ArrayList<SelectItem>(2);
- l.add(new SelectItem("Hello"));
- l.add(new SelectItem("Hi"));
+ l.add(new SelectItem("Hello"));
+ l.add(new SelectItem("Hi"));
GREETINGS = Collections.unmodifiableList(l);
}
@@ -824,10 +796,10 @@
*/
private String greeting;
</programlisting>
- </example>
- <example>
- <title>HelloBean.java</title>
- <programlisting language="Java">
+ </example>
+ <example>
+ <title>HelloBean.java</title>
+ <programlisting language="Java">
/**
* Returns {@link #greeting}.
*
@@ -857,23 +829,22 @@
/**
- * Resets {@link #name} to the default value {@code "World"} and {@link #greeting} with the default value {@code "Hello"}.
+ * Resets {@link #name} to the default value {@code "World"} and {@link #greeting} with the default value {@code "Hello"}.
*
* @param ae ignored
*/
public void reset(ActionEvent ae) {
- this.name = "World";
- this.greeting = "Hello";
+ this.name = "World";
+ this.greeting = "Hello";
}
}
</programlisting>
- </example>
- </section>
- <section id="sid-55477018_JSFPortletDevelopmentwithRichFaces-portlet.xml">
-
- <title>portlet.xml</title>
- <para>
+ </example>
+ </section>
+ <section id="sid-55477018_JSFPortletDevelopmentwithRichFaces-portlet.xml">
+ <title>portlet.xml</title>
+ <para>
There is no substantial change in portlet.xml against the
<xref linkend="sid-55477016"/>
chapter. Only
@@ -886,13 +857,13 @@
<code><title></code>
have been changed.
</para>
- <example>
- <title>portlet.xml</title>
- <programlisting language="XML">
-<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" version="2.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd
- http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd">
+ <example>
+ <title>portlet.xml</title>
+ <programlisting language="XML">
+<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" version="2.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd
+ http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd">
<portlet>
<description>A simple portlet usinf JSF2 and RF4.</description>
<portlet-name>jsf2Rf4HelloWorldPortlet</portlet-name>
@@ -931,21 +902,20 @@
</portlet>
</portlet-app>
</programlisting>
- </example>
- </section>
- <section id="sid-55477018_JSFPortletDevelopmentwithRichFaces-web.xml">
-
- <title>web.xml</title>
- <para>
+ </example>
+ </section>
+ <section id="sid-55477018_JSFPortletDevelopmentwithRichFaces-web.xml">
+ <title>web.xml</title>
+ <para>
We set a few more
<code>init-params</code>
in web.xml for RichFaces components to work:
</para>
- <example>
- <title>web.xml</title>
- <programlisting language="XML">
-<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" version="2.5">
+ <example>
+ <title>web.xml</title>
+ <programlisting language="XML">
+<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" version="2.5">
<display-name>jsf2-rf4-hello-world-portlet</display-name>
<context-param>
<description>See https://docs.jboss.org/author/display/PBR/Installing+Portlet+Bridge#InstallingPortletBridge-DisableautomaticinclusionofPortletBridge</description>
@@ -1017,31 +987,28 @@
</web-app>
</programlisting>
- </example>
- </section>
- <section id="sid-55477018_JSFPortletDevelopmentwithRichFaces-CustomCSS">
-
- <title>Custom CSS</title>
- <para>
+ </example>
+ </section>
+ <section id="sid-55477018_JSFPortletDevelopmentwithRichFaces-CustomCSS">
+ <title>Custom CSS</title>
+ <para>
Fully analogous with
<link linkend="sid-55477016">plain JSF portlets</link>
.
</para>
- </section>
- <section id="sid-55477018_JSFPortletDevelopmentwithRichFaces-Internationalization">
-
- <title>Internationalization</title>
- <para>
+ </section>
+ <section id="sid-55477018_JSFPortletDevelopmentwithRichFaces-Internationalization">
+ <title>Internationalization</title>
+ <para>
Fully analogous with
<link linkend="sid-55477016">plain JSF portlets</link>
.
</para>
- </section>
</section>
- <section id="sid-55477018_JSFPortletDevelopmentwithRichFaces-FurtherSteps">
-
- <title>Further Steps</title>
- <para>
+ </section>
+ <section id="sid-55477018_JSFPortletDevelopmentwithRichFaces-FurtherSteps">
+ <title>Further Steps</title>
+ <para>
After having done all the above, it is time to
<link linkend="sid-55379158">build and deploy the portlet</link>
,
@@ -1050,36 +1017,34 @@
<ulink url="https://docs.jboss.org/author/pages/viewpage.action?pageId=54264655">add it to a page</ulink>
so that you can test its functionality.
</para>
- </section>
- <section id="sid-55477018_JSFPortletDevelopmentwithRichFaces-Seealso">
-
- <title>See also</title>
- <itemizedlist>
- <listitem>
- <para>
+ </section>
+ <section id="sid-55477018_JSFPortletDevelopmentwithRichFaces-Seealso">
+ <title>See also</title>
+ <itemizedlist>
+ <listitem>
+ <para>
<ulink url="https://docs.jboss.org/author/pages/viewpage.action?pageId=54264602">Portlet Primer</ulink>
</para>
- </listitem>
- </itemizedlist>
- </section>
+ </listitem>
+ </itemizedlist>
</section>
</section>
- <section id="sid-55379158">
-
- <title>Building and Deploying Portlets</title>
- <orderedlist>
- <listitem>
- <para>Make sure you have your JBoss Portal Platform instance is running.</para>
- </listitem>
- <listitem>
- <para>Open a command line and navigate to the root directory of your portlet project.</para>
- </listitem>
- <listitem>
- <para>Type this command to build and deploy the archive:</para>
- <informalexample>
- <programlisting>mvn clean package jboss-as:deploy</programlisting>
- </informalexample>
- <para>
+ </section>
+ <section id="sid-55379158">
+ <title>Building and Deploying Portlets</title>
+ <orderedlist>
+ <listitem>
+ <para>Make sure you have your JBoss Portal Platform instance is running.</para>
+ </listitem>
+ <listitem>
+ <para>Open a command line and navigate to the root directory of your portlet project.</para>
+ </listitem>
+ <listitem>
+ <para>Type this command to build and deploy the archive:</para>
+ <informalexample>
+ <programlisting>mvn clean package jboss-as:deploy</programlisting>
+ </informalexample>
+ <para>
To deploy to other than default
<code>localhost:9999</code>
JBoss Portal Platform instance, copy the following configuration just after
@@ -1092,24 +1057,24 @@
<code><username></code>
and
<code><password></code>
- elements can be omitted sometimes, depending on JBoss Portal Platform's security settings.
+ elements can be omitted sometimes, depending on JBoss Portal Platform's security settings.
</para>
- <informalexample>
- <programlisting language="XML"><configuration>
+ <informalexample>
+ <programlisting language="XML"><configuration>
<hostname>127.0.0.1</hostname>
<port>9999</port>
<username>admin</username>
<password>secret</password>
</configuration></programlisting>
- </informalexample>
- <para>
+ </informalexample>
+ <para>
This will deploy
<code>target/simplest-hello-world-portlet.war</code>
to the running instance of the portal.
</para>
- </listitem>
- </orderedlist>
- </section>
+ </listitem>
+ </orderedlist>
</section>
+ </section>
</chapter>
Modified: epp/docs/branches/6.0/Developer_Guide/en-US/chapter-6-GDG_JavaScript_Development.xml
===================================================================
(Binary files differ)
More information about the gatein-commits
mailing list