From do-not-reply at jboss.org Wed Jan 30 23:39:22 2013 Content-Type: multipart/mixed; boundary="===============1112634724031380313==" MIME-Version: 1.0 From: do-not-reply at jboss.org To: gatein-commits at lists.jboss.org Subject: [gatein-commits] gatein SVN: r9104 - epp/docs/branches/6.0/Developer_Guide/en-US. Date: Wed, 30 Jan 2013 23:39:22 -0500 Message-ID: <201301310439.r0V4dMWR010139@svn01.web.mwc.hst.phx2.redhat.com> --===============1112634724031380313== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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_de= velopment.xml epp/docs/branches/6.0/Developer_Guide/en-US/chapter-6-GDG_JavaScript_Dev= elopment.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 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- epp/docs/branches/6.0/Developer_Guide/en-US/Revision_History.xml 2013-0= 1-31 02:44:30 UTC (rev 9103) +++ epp/docs/branches/6.0/Developer_Guide/en-US/Revision_History.xml 2013-0= 1-31 04:39:21 UTC (rev 9104) @@ -5,7 +5,7 @@ - 6.0.0-8 + 6.0.0-9 Thu Jan 31 2013 Jared Modified: epp/docs/branches/6.0/Developer_Guide/en-US/chapter-5-GDG_Applica= tion_development.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- epp/docs/branches/6.0/Developer_Guide/en-US/chapter-5-GDG_Application_d= evelopment.xml 2013-01-31 02:44:30 UTC (rev 9103) +++ epp/docs/branches/6.0/Developer_Guide/en-US/chapter-5-GDG_Application_d= evelopment.xml 2013-01-31 04:39:21 UTC (rev 9104) @@ -30,28 +30,25 @@
Portlet Development - JBoss Portal Platform's interface is fully customizable with a= pplications called portlets. Application development can be done by using t= he plain Portlet specification JSR286 (refer to the "Portlet Primer&qu= ot; chapter in the JBoss Portal Platform Reference Guide for more information), but it is also possible to use the JBoss Portle= t Bridge to write applications with JavaServerFaces (JSF), RichFaces or Sea= m (refer to the "Getting started with JBoss Portlet Bridge" chapt= er of the JBoss Portal Platform Reference Guide). + JBoss Portal Platform's interface is fully customizable w= ith applications called portlets. Application development can be done by us= ing the plain Portlet specification JSR286 (refer to the "Portlet Prim= er" chapter in the JBoss Portal Platform Reference Guide for more information), but it is also possible to use the JBoss P= ortlet Bridge to write applications with JavaServerFaces (JSF), RichFaces o= r Seam (refer to the "Getting started with JBoss Portlet Bridge" = chapter of the JBoss Portal Platform Reference Guide). Whichever technology you choose, refer to Starting a Portlet Project to learn how to set up your pr= oject in a robust and effective way using the JBoss Portal Platform Bill of= Materials (BOM). -
- = - Starting a Portlet Project -
- = - The BOM Concept - +
+ Starting a Portlet Project +
+ The BOM Concept + To make the management of dependencies easier, JBoss Portal Pl= atform Team has prepared the Bill of Materials (BOM) needed for developing = typical portlet applications. BOM is a Maven pom.xml file whic= h specifies the versions, types and scopes of dependencies which are grante= d to be compatible with (or indeed in many cases provided by) JBoss Portal = Platform. -
-
- = - How to Use JBoss Portal Platform BOM - +
+
+ How to Use JBoss Portal Platform BOM + Let us look at the pom.xml file from Simplest Hel= lo World Portket example below, which contains all necessary details. - + In its <dependencyManagement> section, it d= eclares = <dependency> gatein-3.5-bom @@ -60,11 +57,11 @@ import . It indicates that the dependency will de facto be replaced with the dependencies in its dep= endencyManagement section. Due to this fact, in the <d= ependencies> section of the Simplest Hello World pom.xml, we can declare the javax.portlet:portlet-api dependency = without specifying its <version>, <type> or <scope>. All those details are managed by g= atein-3.5-bom. - - Simplest Hello World Portlet - -<project xmlns=3D"http://maven.apache.org/POM/4.0.0" xmlns:xsi=3D"http:= //www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation=3D"http://maven.apache.org/POM/4.0.0 http://maven.a= pache.org/maven-v4_0_0.xsd"> + + Simplest Hello World Portlet + +<project xmlns=3D"http://maven.apache.org/POM/4.0.0" xmlns:xs= i=3D"http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation=3D"http://maven.apache.org/POM/4.0.0 http://ma= ven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> = <artifactId>simplest-hello-world-portlet</artifactId> @@ -148,24 +145,22 @@ = </project> - - + + Further steps, after you have set up the pom.xml = file for your project, depend on the technology you have chosen for writing= portlets. -
-
- = - Standard Portlet Development (JSR286) -
- = - The Java Part - - After setting up the the Maven pom.xml file as sh= own in the previous section, we can continue with implementing a basic JSR2= 86 compatible portlet. Simplest Hello World Portlet from the JBoss Portal P= latform Quickstarts collection shows = the very essence of every JSR286 Portlet: +
+
+ Standard Portlet Development (JSR286) +
+ The Java Part + + After setting up the the Maven pom.xml file as sh= own in the previous section, we can continue with implementing a basic JSR2= 86 compatible portlet. An example of such a portlet is contained in the JBo= ss Portal Platform Quickstart "Simplest Hello World Portlet" - - SimplestHelloWorldPortlet.java - + + SimplestHelloWorldPortlet.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 respo= nse writer. * = * @see javax.portlet.GenericPortlet#doView(javax.portlet.RenderReques= t, javax.portlet.RenderResponse) */ @Override public void doView(RenderRequest request, RenderResponse response) thr= ows IOException { PrintWriter writer =3D response.getWriter(); - writer.write("Hello World !"); + writer.write("Hello World !"); writer.close(); } } - - As you can see in the listing, we have done two important = things: - - - + + As you can see in the listing, we have done two important th= ings: + + + We extended javax.portlet.GenericPortlet from javax.portlet:portlet-api artifact. - - - + + + We have overriden the doView() method. - - - + + + In this simplest portlet variant, EDIT and HELP portlet modes = are not supported. To add them, override the doEdit() and doHelp from javax.portlet.GenericPortlet and configur= e the portlet.xml file accordingly. -
-
- = - portlet.xml - +
+
+ portlet.xml + The portlet.xml file for a plain JSR286 portlet is as follows: - - portlet.xml - -<portlet-app xmlns=3D"http://java.sun.com/xml/ns/portlet/portlet-app_2_= 0.xsd" version=3D"2.0" - xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLoca= tion=3D"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.xml + +<portlet-app xmlns=3D"http://java.sun.com/xml/ns/portlet/portlet-a= pp_2_0.xsd" version=3D"2.0" + xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance" xsi:= schemaLocation=3D"http://java.sun.com/xml/ns/portlet/portlet-app_2_0.x= sd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"> <portlet> <description>Simplest Hello World Portlet is the very essenc= e of every possible Portlet.</description> <portlet-name>SimplestHelloWorldPortlet</portlet-name> @@ -250,33 +244,31 @@ </portlet> </portlet-app> - -
-
- = - web.xml - + +
+
+ web.xml + 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 web.xml. To solve it, include a web.xml file which contains solely the root element: - - web.xml - -<web-app xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation=3D"http://java.sun.com/xml/ns/javaee http://jav= a.sun.com/xml/ns/javaee/web-app_2_5.xsd" - version=3D"2.5"> + + web.xml + +<web-app xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance&qu= ot; + xsi:schemaLocation=3D"http://java.sun.com/xml/ns/javaee http:= //java.sun.com/xml/ns/javaee/web-app_2_5.xsd" + version=3D"2.5"> <!-- = There is no need to configure any filters, servlets, mapping &= amp; co. for this demo to work but maven-war-plugin by default requires this file. --> </web-app> - -
-
- = - Further Steps - + +
+
+ Further Steps + After having done all the above, it is time to build and deploy the portlet , @@ -285,53 +277,48 @@ add it to a page so that you can test its functionality. -
-
- = - See also - - - +
+
+ See also + + + Portlet Primer - - - + + + JSR28= 6 - - -
+ +
-
- = - JSF2 Portlet Development - +
+
+ JSF2 Portlet Development + The Portlet Bridge pre-installed in JBoss Portal Platform allows= for implementing portlets with JavaServer Faces (JSF) 2.1 and RichFaces (R= F) 4.2.3. As RichFaces is a component library for JavaServer Faces, the gui= delines 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 and when developing with RichFaces. -
- = - Basic JSF Portlet Development - JSF stands for JavaServer Pages. The JSF version delivered= by the built-in Portlet Bridge is 2.1. -
- = - Example Code +
+ Basic JSF Portlet Development + JSF stands for JavaServer Pages. The JSF version delivered b= y the built-in Portlet Bridge is 2.1. +
+ Example Code + + This section mentions code from the JSF2 Hello World Portlet e= xample in the JBoss Portal Platform Quickstarts, available for download fr= om as part of your JBoss Portal= Platform subscription. + +
+ pom.xml - This section cites code from JSF2 Hello World Portlet from t= he JBoss Portal Platform Quickstarts = collection. - -
- = - pom.xml - There is only one noticeable difference in pom.x= ml against what we have shown as a general case in the Starting a Portlet Project section. The depend= encies are different for JSF: - - pom.xml - + + pom.xml + <dependencies> <!-- = The versions, scopes and types of these dependencies are mana= ged in gatein-*-bom. @@ -349,20 +336,19 @@ </dependency> </dependencies> - -
-
- = - JSF Template Files - + +
+
+ JSF Template Files + In the following listing you can see the beginning of a ty= pical JSF portlet template. It is taken from main.xhtml file located in src/main/webapp/pages directory. - Code Snippet error: Read timed out. - + Code Snippet error: Read timed out. + Note that <f:view> as a root element of the portlet template above prevents a= n erroneous @@ -375,7 +361,7 @@ <h:body> elements are always needed for JSF Facelets to work. - + The following listing shows the use of several JSF element= s, such as <h:outputLabel> , @@ -386,27 +372,26 @@ <h:form> . - Code Snippet error: Read timed out. - + Code Snippet error: Read timed out. + The complete source code of the above template can be foun= d in src/main/webapp/pages/main.xhtml of JSF2 Hello World Portlet project. -
-
- = - Java Beans - +
+
+ Java Beans + In the JSF template file shown above, we refer to helloBean . This bean is implemented in Java as follows: - - + + /** * {@link HelloBean} is the JSF backing bean for the application, holding= the input data to be re-displayed. */ - @ManagedBean(name =3D "helloBean") + @ManagedBean(name =3D "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 =3D "World"; + this.name =3D "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 =3D "World"; + this.name =3D "World"; } = } - - + + The @ManagedBean and @@ -464,18 +449,17 @@ faces-config.xml file. -
-
- = +
+
+ portlet.xml + portlet.xml is the place where we tie the JSF templates = with the portlet. + portlet.xml - portlet.xml is the place where we tie the JSF template= s with the portlet. - - portlet.xml - -<portlet-app xmlns=3D"http://java.sun.com/xml/ns/portlet/portlet-app_2_= 0.xsd" version=3D"2.0" - xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation=3D"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-app xmlns=3D"http://java.sun.com/xml/ns/portlet/portlet-a= pp_2_0.xsd" version=3D"2.0" + xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation=3D"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 @@ = = - - + + Note that the javax.portlet.faces.defaultViewId.* init-params @@ -527,20 +511,19 @@ <portlet-class> will serve the purpose for most JSF portlets. -
-
- = - web.xml - +
+
+ web.xml + JSF portlets require a few tweaks in the web.xml file: - - web.xml - -<web-app xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance" xmlns= =3D"http://java.sun.com/xml/ns/javaee" xmlns:web=3D"http://java.sun.com/xml= /ns/javaee/web-app_2_5.xsd" - xsi:schemaLocation=3D"http://java.sun.com/xml/ns/javaee http://java.su= n.com/xml/ns/javaee/web-app_2_5.xsd" version=3D"2.5"> + + web.xml + +<web-app xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance&qu= ot; xmlns=3D"http://java.sun.com/xml/ns/javaee" xmlns:web=3D"= ;http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" + xsi:schemaLocation=3D"http://java.sun.com/xml/ns/javaee http://ja= va.sun.com/xml/ns/javaee/web-app_2_5.xsd" version=3D"2.5"> <display-name>jsf2-hello-world-portlet</display-name> <context-param> <description>See https://docs.jboss.org/author/display/PBR/R= ender+Policy</description> @@ -573,14 +556,13 @@ </servlet-mapping> </web-app> - -
-
- = - Custom CSS - - Portlet Bridge supports loading of CSS resources in the "J= SF way". Use the - <h:outputStylesheet library=3D"css" name=3D"jsf2-= hello-world-portlet.css" /> + +
+
+ Custom CSS + + Portlet Bridge supports loading of CSS resources in the &q= uot;JSF way". Use the + <h:outputStylesheet library=3D"css" nam= e=3D"jsf2-hello-world-portlet.css" /> as in the main.xhtml file above. The @@ -589,32 +571,32 @@ resources/css folder of the web application. - + Note that relative paths like - url('css/background/jsf-logo.png') + url('css/background/jsf-logo.png') do not work when used in CSS loaded via <h:outputStylesheet ...> . Rather a JSF Expression Language expression - #{resource['/css/background/jsf-logo.png'] + #{resource['/css/background/jsf-logo.png']= } needs to be used. This expression is dynamically evaluat= ed to a proper public URL. The path - '/css/background/jsf-logo.png' + '/css/background/jsf-logo.png' used in the expression is relative to resources folder of the web application. See also Resource Serving . - - jsf2-hello-world-portlet.css - + + jsf2-hello-world-portlet.css + div.jsf2HelloWorldPortlet { padding: 10px; /* In the following we use a JSF Expression Language expression rathe= r 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/backg= round/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 we= b application. See https://docs.jboss.org/author/display/PBR/Resource+Serving */ - background: url(#{resource['/css/background/jsf-logo.png']}) no-repea= t; + background: url(#{resource['/css/background/jsf-logo.png']}= ) no-repeat; background-position-x: 753px; background-position-y: 10px; } @@ -622,12 +604,11 @@ width: 713px; = } - -
-
- = - Internationalization - + +
+
+ Internationalization + Internationalization is supported via standard Java Resour= ce bundles. In our example project the *.property files of @@ -638,11 +619,11 @@ faces-config.xml are needed so that this bundle can be used in JSF template= s. - - faces-config.xml - -<faces-config xmlns=3D"http://java.sun.com/xml/ns/javaee" xmlns:xsi=3D"= http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation=3D"http://java.sun.com/xml/ns/javaee http://java.su= n.com/xml/ns/javaee/web-facesconfig_2_0.xsd" version=3D"2.0"> + + faces-config.xml + +<faces-config xmlns=3D"http://java.sun.com/xml/ns/javaee" xml= ns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation=3D"http://java.sun.com/xml/ns/javaee http://ja= va.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd" version=3D"2.0&= quot;> <application> <!-- Declare the internationalization resources --> <resource-bundle> @@ -657,20 +638,19 @@ </application> </faces-config> - - + + Note that in the above faces-config.xml, we have made our = bundle visible in JSF templates under the variable msgs . Its individual entries can then be accessed using the us= ual Expression Language dot notation: e.g. #{msgs.Name }. -
-
- = - Further Steps - +
+
+ Further Steps + After having done all the above, it is time to build and deploy the portlet<= /link> , @@ -679,42 +659,36 @@ add it to a page so that you can test its functionality. -
-
- = - See also - - - +
+
+ See also + + + Portlet Primer - - -
+ +
-
- = - JSF Portlet Development with RichFaces - +
+
+ JSF Portlet Development with RichFaces + As we have already noted, RichFaces (RF) is just a component l= ibrary for JavaServer Faces (JSF). Therefore, everything said in the chapter applies here too. -
- = - Example Code - - This section cites code from JSF2+RF4 Hello World Portlet fr= om the - JBoss Portal Platform Quickst= arts - collection. - -
- = +
+ Example Code + + This section mentions code from the JSF2+RF4 Hello World Portl= et example in the JBoss Portal Platform Quickstarts, available for downloa= d from as part of your JBoss Po= rtal Platform subscription. + +
+ pom.xml + We need to add several RF-specific dependencies to the g= eneral JSF ones: + pom.xml - We need to add several RF-specific dependencies to the= general JSF ones: - - pom.xml - + <dependencies> <!-- = The versions, scopes and types of these dependencies are mana= ged in gatein-*-bom. @@ -751,71 +725,69 @@ </dependency> </dependencies> - -
-
- = - JSF Template Files - + +
+
+ JSF Template Files + We use <rich:*> components in the templates: - - Form with rich: components in main.xhtml - + + Form with rich: components in main.xhtml + </p> - <h:form id=3D"jsf2HelloWorldPortlet"> - <h:panelGrid columns=3D"2"> - <h:outputLabel value=3D"#{msgs.Greeting}" for=3D"greet= ing"/> - <rich:select id=3D"greeting" value=3D"#{helloBean.gree= ting}"> - <f:selectItems value=3D"#{helloBean.greetings}" /&= gt; - <f:ajax render=3D"output" event=3D"selectitem"/> + <h:form id=3D"jsf2HelloWorldPortlet"> + <h:panelGrid columns=3D"2"> + <h:outputLabel value=3D"#{msgs.Greeting}" fo= r=3D"greeting"/> + <rich:select id=3D"greeting" value=3D"#= {helloBean.greeting}"> + <f:selectItems value=3D"#{helloBean.greetings= }" /> + <f:ajax render=3D"output" event=3D"= selectitem"/> </rich:select> = - <h:outputLabel value=3D"#{msgs.Name}" for=3D"nameInput= "/> - <h:inputText id=3D"nameInput" value=3D"#{helloBean.nam= e}"> - <f:validateLength minimum=3D"1" maximum=3D"50" /&g= t; - <f:ajax render=3D"output" event=3D"keyup"/> + <h:outputLabel value=3D"#{msgs.Name}" for=3D= "nameInput"/> + <h:inputText id=3D"nameInput" value=3D"= #{helloBean.name}"> + <f:validateLength minimum=3D"1" maximum= =3D"50" /> + <f:ajax render=3D"output" event=3D"= keyup"/> </h:inputText> </h:panelGrid> <p> - <h:panelGroup id=3D"output"> - <strong><h:outputText value=3D"#{helloBean.g= reeting} #{helloBean.name}!" rendered=3D"#{not empty helloBean.name}"/>&= lt;/strong> + <h:panelGroup id=3D"output"> + <strong><h:outputText value=3D"#{helloB= ean.greeting} #{helloBean.name}!" rendered=3D"#{not empty helloBe= an.name}"/></strong> </h:panelGroup> </p> <p> - <h:commandButton id=3D"reset" value=3D"#{msgs.Reset}" = actionListener=3D"#{helloBean.reset}"> - <f:ajax render=3D"@form" /> + <h:commandButton id=3D"reset" value=3D"= #{msgs.Reset}" actionListener=3D"#{helloBean.reset}"> + <f:ajax render=3D"@form" /> </h:commandButton> - #{msgs.ResetComment} </p> <p> - <h:commandButton id=3D"reload" value=3D"#{msgs.Reload}= " /> - #{msgs.ReloadComment} + <h:commandButton id=3D"reload" value=3D"= ;#{msgs.Reload}" /> - #{msgs.ReloadComment} </p> - - The complete source code of the above template can be = found in src/main/webapp/pages/main.xhtml of JSF2+RF4 Hello World Portlet q= uickstart. -
-
- = - Java Beans - + + The complete source code of the above template can be fo= und in src/main/webapp/pages/main.xhtml of JSF2+RF4 Hello World Portlet qui= ckstart. +
+
+ Java Beans + The HelloBean presented in the chapter was extended firstly to provide a list of greeting= phrases selectable in the drop-down box on the main.xhtml page and secondl= y to be able to store the greeting phrase selected in the drop-down box. - - HelloBean.java - + + HelloBean.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 =3D 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 =3D Collections.unmodifiableList(l); } = @@ -824,10 +796,10 @@ */ private String greeting; - - - HelloBean.java - + + + HelloBean.java + /** * Returns {@link #greeting}. * = @@ -857,23 +829,22 @@ = = /** - * Resets {@link #name} to the default value {@code "World"} and {@li= nk #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 =3D "World"; - this.greeting =3D "Hello"; + this.name =3D "World"; + this.greeting =3D "Hello"; } = } - -
-
- = - portlet.xml - + +
+
+ portlet.xml + There is no substantial change in portlet.xml against the chapter. Only @@ -886,13 +857,13 @@ <title> have been changed. - - portlet.xml - -<portlet-app xmlns=3D"http://java.sun.com/xml/ns/portlet/portlet-app_2_= 0.xsd" version=3D"2.0" - xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation=3D"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.xml + +<portlet-app xmlns=3D"http://java.sun.com/xml/ns/portlet/portlet-a= pp_2_0.xsd" version=3D"2.0" + xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation=3D"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.</descri= ption> <portlet-name>jsf2Rf4HelloWorldPortlet</portlet-name> @@ -931,21 +902,20 @@ </portlet> </portlet-app> - -
-
- = - web.xml - + +
+
+ web.xml + We set a few more init-params in web.xml for RichFaces components to work: - - web.xml - -<web-app xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance" xmlns= =3D"http://java.sun.com/xml/ns/javaee" xmlns:web=3D"http://java.sun.com/xml= /ns/javaee/web-app_2_5.xsd" - xsi:schemaLocation=3D"http://java.sun.com/xml/ns/javaee http://java.su= n.com/xml/ns/javaee/web-app_2_5.xsd" version=3D"2.5"> + + web.xml + +<web-app xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance&qu= ot; xmlns=3D"http://java.sun.com/xml/ns/javaee" xmlns:web=3D"= ;http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" + xsi:schemaLocation=3D"http://java.sun.com/xml/ns/javaee http://ja= va.sun.com/xml/ns/javaee/web-app_2_5.xsd" version=3D"2.5"> <display-name>jsf2-rf4-hello-world-portlet</display-name> <context-param> <description>See https://docs.jboss.org/author/display/PBR/I= nstalling+Portlet+Bridge#InstallingPortletBridge-Disableautomaticinclusiono= fPortletBridge</description> @@ -1017,31 +987,28 @@ = </web-app> - -
-
- = - Custom CSS - + +
+
+ Custom CSS + Fully analogous with plain JSF portlets . -
-
- = - Internationalization - +
+
+ Internationalization + Fully analogous with plain JSF portlets . -
-
- = - Further Steps - +
+
+ Further Steps + After having done all the above, it is time to build and deploy the portlet<= /link> , @@ -1050,36 +1017,34 @@ add it to a page so that you can test its functionality. -
-
- = - See also - - - +
+
+ See also + + + Portlet Primer - - -
+ +
-
- = - Building and Deploying Portlets - - - Make sure you have your JBoss Portal Platform instance i= s running. - - - Open a command line and navigate to the root directory o= f your portlet project. - - - Type this command to build and deploy the archive: - - mvn clean package jboss-as:deploy - - +
+
+ Building and Deploying Portlets + + + Make sure you have your JBoss Portal Platform instance is = running. + + + Open a command line and navigate to the root directory of = your portlet project. + + + Type this command to build and deploy the archive: + + mvn clean package jboss-as:deploy + + To deploy to other than default localhost:9999 JBoss Portal Platform instance, copy the following configura= tion just after @@ -1092,24 +1057,24 @@ <username> and <password> - 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. = - - <configuration> + + <configuration> <hostname>127.0.0.1</hostname> <port>9999</port> <username>admin</username> <password>secret</password> </configuration> - - + + This will deploy target/simplest-hello-world-portlet.war to the running instance of the portal. - - -
+ +
+
Modified: epp/docs/branches/6.0/Developer_Guide/en-US/chapter-6-GDG_JavaScr= ipt_Development.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D (Binary files differ) --===============1112634724031380313==--