Author: manaRH
Date: 2012-07-17 11:36:31 -0400 (Tue, 17 Jul 2012)
New Revision: 14982
Modified:
branches/community/Seam_2_3/seam-reference-guide/src/docbook/en-US/Configuration.xml
branches/community/Seam_2_3/seam-reference-guide/src/docbook/en-US/Getting_Started_With_JBoss_Tools.xml
branches/community/Seam_2_3/seam-reference-guide/src/docbook/en-US/Gettingstarted.xml
branches/community/Seam_2_3/seam-reference-guide/src/docbook/en-US/Gwt.xml
branches/community/Seam_2_3/seam-reference-guide/src/docbook/en-US/I18n.xml
branches/community/Seam_2_3/seam-reference-guide/src/docbook/en-US/Mail.xml
branches/community/Seam_2_3/seam-reference-guide/src/docbook/en-US/Testing.xml
branches/community/Seam_2_3/seam-reference-guide/src/docbook/en-US/Tutorial.xml
Log:
first changes to documentation JBSEAM-4987
Modified:
branches/community/Seam_2_3/seam-reference-guide/src/docbook/en-US/Configuration.xml
===================================================================
---
branches/community/Seam_2_3/seam-reference-guide/src/docbook/en-US/Configuration.xml 2012-07-17
15:36:16 UTC (rev 14981)
+++
branches/community/Seam_2_3/seam-reference-guide/src/docbook/en-US/Configuration.xml 2012-07-17
15:36:31 UTC (rev 14982)
@@ -70,36 +70,6 @@
</sect2>
<sect2>
- <title>Using Facelets</title>
-
- <para> If you want follow our advice and use Facelets instead of JSP,
add the following lines to
- <literal>faces-config.xml</literal>: </para>
-
- <programlisting role="XML"><![CDATA[<application>
- <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
-</application>]]></programlisting>
-
- <para> And the following lines to
<literal>web.xml</literal>: </para>
-
- <programlisting role="XML"><![CDATA[<context-param>
- <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
- <param-value>.xhtml</param-value>
-</context-param>]]></programlisting>
-
- <para>
- If you are using facelets in JBoss AS, you'll find that Facelets
logging is broken (the log messages
- don't make it to the server log). Seam provides a bridge to fix this,
to use it copy
- <literal>lib/interop/jboss-seam-jul.jar</literal> to
-
<literal>$JBOSS_HOME/server/default/deploy/jboss-web.deployer/jsf-libs/</literal>
and include the
- <literal>jboss-seam-ui.jar</literal> in the
<literal>WEB-INF/lib</literal> of your application. The
- Facelets logging catagories are itemized in the <ulink
-
url="https://facelets.dev.java.net/nonav/docs/dev/docbook.html#confi...
Developer
- Documentation</ulink>.
- </para>
-
- </sect2>
-
- <sect2>
<title>Seam Resource Servlet</title>
<para> The Seam Resource Servlet provides resources used by Seam
Remoting, captchas (see the security
@@ -750,9 +720,6 @@
<para> If you want to use jBPM or Drools, you must include the needed
jars in the EAR's lib directory.</para>
- <para> If you want to use facelets (our recommendation), you must
include
- <literal>jsf-facelets.jar</literal> in the
<literal>WEB-INF/lib</literal> directory of the WAR. </para>
-
<para> If you want to use the Seam tag library (most Seam applications
do), you must include
<literal>jboss-seam-ui.jar</literal> in the
<literal>WEB-INF/lib</literal> directory of the WAR. If
you want to use the PDF or email tag libraries, you need to put
<literal>jboss-seam-pdf.jar</literal> or
@@ -773,10 +740,10 @@
</sect1>
<sect1>
- <title>Configuring Seam in J2EE</title>
+ <title>Configuring Seam in Java EE</title>
<para> Seam is useful even if you're not yet ready to take the plunge
into EJB 3.0. In this case you would use
- Hibernate3 or JPA instead of EJB 3.0 persistence, and plain JavaBeans instead
of session beans. You'll miss
+ Hibernate4 or JPA instead of EJB 3.0 persistence, and plain JavaBeans instead
of session beans. You'll miss
out on some of the nice features of session beans but it will be very easy to
migrate to EJB 3.0 when you're
ready and, in the meantime, you'll be able to take advantage of
Seam's unique declarative state management
architecture. </para>
@@ -848,8 +815,7 @@
jboss-seam.jar
jboss-seam-ui.jar
jboss-el.jar
- jsf-facelets.jar
- hibernate3.jar
+ hibernate-core.jar
hibernate-annotations.jar
hibernate-validator.jar
...
@@ -876,7 +842,7 @@
</sect1>
<sect1>
- <title>Configuring Seam in Java SE, without JBoss Embedded</title>
+ <title>Configuring Seam in Java SE</title>
<para> It is possible to use Seam completely outside of an EE environment.
In this case, you need to tell Seam
how to manage transactions, since there will be no JTA available. If
you're using JPA, you can tell
@@ -889,180 +855,10 @@
<programlisting
role="XML"><![CDATA[<transaction:hibernate-transaction
session="#{session}"/>]]></programlisting>
<para> Of course, you'll also need to define a
datasource.</para>
-
- <para> A better alternative is to use JBoss Embedded to get access to the
EE APIs. </para>
</sect1>
<sect1>
- <title>Configuring Seam in Java SE, with JBoss Embedded</title>
-
- <para> JBoss Embedded lets you run EJB3 components outside the context of
the Java EE 5 application server. This
- is especially, but not only, useful for testing. </para>
-
- <para> The Seam booking example application includes a TestNG integration
test suite that runs on JBoss Embedded
- via <literal>SeamTest</literal>. </para>
-
- <mediaobject>
- <imageobject role="fo">
- <imagedata fileref="images/testng.png"
align="center"/>
- </imageobject>
- <imageobject role="html">
- <imagedata fileref="images/testng.png"
align="center"/>
- </imageobject>
- </mediaobject>
-
- <para> The booking example application may even be deployed to Tomcat.
</para>
-
- <mediaobject>
- <imageobject role="fo">
- <imagedata fileref="images/e-ejb3.png"
align="center"/>
- </imageobject>
- <imageobject role="html">
- <imagedata fileref="images/e-ejb3.png"
align="center"/>
- </imageobject>
- </mediaobject>
-
- <sect2 id="config.install.embedded">
- <title>Installing Embedded JBoss</title>
-
-
- <para>
- Embedded JBoss must by installed into Tomcat for Seam applications
- to run correctly on it. Embedded JBoss runs with JDK 5 or JDK 6 (
- see <xref linkend="jdk_dependencies" /> for details on
using JDK 6).
- Embedded JBoss can be downloaded
- <ulink
url="http://sourceforge.net/projects/jboss/files/Embedded%20JBoss/Em...;.
- The process for installing Embedded JBoss into Tomcat 6 is quite
- simple. First, you should copy the Embedded JBoss JARs and
- configuration files into Tomcat.
- </para>
-
- <itemizedlist>
-
- <listitem>
- <para> Copy all files and directories under the Embedded JBoss
<literal>bootstrap</literal> and
- <literal>lib</literal> directories, except for
the <literal>jndi.properties</literal> file,
- into the Tomcat <literal>lib</literal> directory.
</para>
- </listitem>
-
-
- <listitem>
- <para>Remove the
<literal>annotations-api.jar</literal> file from the Tomcat
<literal>lib</literal>
- directory. </para>
- </listitem>
- </itemizedlist>
-
-
- <para>Next, two configuration files need to be updated to add Embedded
JBoss-specific functionality.</para>
-
- <itemizedlist>
-
-
- <listitem>
- <para> Add the Embedded JBoss listener
<literal>EmbeddedJBossBootstrapListener</literal> to
- <literal>conf/server.xml</literal>. It must appear
after all other listeners in the file:</para>
-
- <programlisting role="XML"><![CDATA[<Server
port="8005" shutdown="SHUTDOWN">
-
- <!-- Comment these entries out to disable JMX MBeans support used for the
- administration web application -->
- <Listener className="org.apache.catalina.core.AprLifecycleListener" />
- <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"
/>
- <Listener
className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
- <Listener
className="org.apache.catalina.storeconfig.StoreConfigLifecycleListener"
/>]]></programlisting>
- <programlisting role="XML"><![CDATA[ <!-- Add
this listener -->
- <Listener
className="org.jboss.embedded.tomcat.EmbeddedJBossBootstrapListener"
/>]]></programlisting>
- </listitem>
-
- <listitem>
- <para>WAR file scanning should be enabled by adding the
<literal>WebinfScanner</literal> listener to
- <literal>conf/context.xml</literal>:
</para>
-
- <programlisting
role="XML"><![CDATA[<Context>
- <!-- Default set of monitored resources -->
- <WatchedResource>WEB-INF/web.xml</WatchedResource>
-
- <!-- Uncomment this to disable session persistence across Tomcat restarts -->
- <!--
- <Manager pathname="" />
- -->]]></programlisting>
- <programlisting role="XML"><![CDATA[ <!-- Add
this listener -->
- <Listener className="org.jboss.embedded.tomcat.WebinfScanner"
/>]]></programlisting>
- <programlisting
role="XML"><![CDATA[</Context>]]></programlisting>
- </listitem>
-
- <listitem>
- <para>If you are using Sun JDK 6, you need to set the Java
option
-
<literal>sun.lang.ClassLoader.allowArraySyntax</literal> to
<literal>true</literal> in the
- JAVA_OPTS environment variable used by the Catalina startup
script (catalina.bat on Windows or
- catalina.sh on Unix).</para>
-
- <para>Open the script appropriate for your operating system in
a text editor. Add a new line
- immediately below the comments at the top of the file where you
will define the JAVA_OPTS
- environment variable. On Windows, use the following
syntax:</para>
-
- <programlisting><![CDATA[set JAVA_OPTS=%JAVA_OPTS%
-Dsun.lang.ClassLoader.allowArraySyntax=true]]></programlisting>
-
- <para>On Unix, use this syntax instead:</para>
-
- <programlisting><![CDATA[JAVA_OPTS="$JAVA_OPTS
-Dsun.lang.ClassLoader.allowArraySyntax=true"]]></programlisting>
-
- </listitem>
- </itemizedlist>
-
- <para>For more configuration options, please see the Embedded JBoss
Tomcat integration
- <ulink
url="http://wiki.jboss.org/wiki/Wiki.jsp?page=EmbeddedAndTomcat"...
entry</ulink>.</para>
-
- </sect2>
-
- <sect2>
- <title>Packaging</title>
-
- <para> The archive structure of a WAR-based deployment on an servlet
engine like Tomcat will look something
- like this: </para>
-
- <programlisting><![CDATA[my-application.war/
- META-INF/
- MANIFEST.MF
- WEB-INF/
- web.xml
- components.xml
- faces-config.xml
- lib/
- jboss-seam.jar
- jboss-seam-ui.jar
- jboss-el.jar
- jsf-facelets.jar
- jsf-api.jar
- jsf-impl.jar
- ...
- my-application.jar/
- META-INF/
- MANIFEST.MF
- persistence.xml
- seam.properties
- org/
- jboss/
- myapplication/
- User.class
- Login.class
- LoginBean.class
- Register.class
- RegisterBean.class
- ...
- login.jsp
- register.jsp
- ...]]></programlisting>
-
- <para> Most of the Seam example applications may be deployed to Tomcat
by running <literal>ant
- deploy.tomcat</literal>. </para>
-
- </sect2>
-
- </sect1>
-
- <sect1>
<title>Configuring jBPM in Seam</title>
<para> Seam's jBPM integration is not installed by default, so
you'll need to enable jBPM by installing a
built-in component. You'll also need to explicitly list your process and
pageflow definitions. In
@@ -1119,7 +915,7 @@
jboss-seam.jar
lib/
jboss-el.jar
- jbpm-3.1.jar
+ jbpm-jpdl.jar
META-INF/
MANIFEST.MF
application.xml
@@ -1131,7 +927,6 @@
components.xml
faces-config.xml
lib/
- jsf-facelets.jar
jboss-seam-ui.jar
login.jsp
register.jsp
@@ -1162,49 +957,38 @@
</sect1>
<sect1>
- <title>Configuring SFSB and Session Timeouts in JBoss AS</title>
+ <title>Configuring SFSB and Session Timeouts in JBoss AS 7</title>
<para> It is very important that the timeout for Stateful Session Beans is
set higher than the timeout for HTTP
Sessions, otherwise SFSB's may time out before the user's HTTP
session has ended. JBoss Application Server
has a default session bean timeout of 30 minutes, which is configured in
- <literal>server/default/conf/standardjboss.xml</literal>
(replace <emphasis>default</emphasis> with your
- own configuration). </para>
+ <literal>standalone/configuration/standalone.xml</literal>
(replace <emphasis>standalone.xml</emphasis> with your
+ standalone-full.xml if you use full profile). </para>
- <para> The default SFSB timeout can be adjusted by modifying the value of
<literal>max-bean-life</literal> in
- the <literal>LRUStatefulContextCachePolicy</literal> cache
configuration: </para>
+ <para> The default SFSB timeout can be adjusted by modifying the value of
<literal>default-access-timeout</literal> in
+ the EJB subsystem <literal>subsystem
xmlns="urn:jboss:domain:ejb3:1.2"</literal>: </para>
- <programlisting
role="XML"><![CDATA[<container-cache-conf>
-
<cache-policy>org.jboss.ejb.plugins.LRUStatefulContextCachePolicy</cache-policy>
- <cache-policy-conf>
- <min-capacity>50</min-capacity>
- <max-capacity>1000000</max-capacity>
- <remover-period>1800</remover-period>
+ <programlisting role="XML"><![CDATA[<subsystem
xmlns="urn:jboss:domain:ejb3:1.2">
+ <session-bean>
+ <stateless>
+ <bean-instance-pool-ref
pool-name="slsb-strict-max-pool"/>
+ </stateless>
+ <stateful default-access-timeout="5000"
cache-ref="simple"/>
+ <singleton default-access-timeout="5000"/>
+ </session-bean>
+ ...
+</subsystem>]]></programlisting>
- <!-- SFSB timeout in seconds; 1800 seconds == 30 minutes -->
- <max-bean-life>1800</max-bean-life>
+ <para> The default HTTP session timeout can't be modified in JBoss AS
7.</para>
- <overager-period>300</overager-period>
- <max-bean-age>600</max-bean-age>
- <resizer-period>400</resizer-period>
- <max-cache-miss-period>60</max-cache-miss-period>
- <min-cache-miss-period>1</min-cache-miss-period>
- <cache-load-factor>0.75</cache-load-factor>
- </cache-policy-conf>
-</container-cache-conf>]]></programlisting>
+ <para> To override default value for your own application, simply include
<literal>session-timeout</literal> entry in your application's own
+ <literal>web.xml</literal>: </para>
+
+ <programlisting>
+ <![CDATA[<session-config>
+ <session-timeout>30</session-timeout>
+ </session-config>]]></programlisting>
- <para> The default HTTP session timeout can be modified in
-
<literal>server/default/deploy/jbossweb-tomcat55.sar/conf/web.xml</literal>
for JBoss 4.0.x, or in
-
<literal>server/default/deploy/jboss-web.deployer/conf/web.xml</literal> for
JBoss 4.2.x or later. The following
- entry in this file controls the default session timeout for all web
applications: </para>
-
- <programlisting role="XML"><![CDATA[<session-config>
- <!-- HTTP Session timeout, in minutes -->
- <session-timeout>30</session-timeout>
-</session-config>]]></programlisting>
-
- <para> To override this value for your own application, simply include this
entry in your application's own
- <literal>web.xml</literal>. </para>
-
</sect1>
<sect1>
Modified:
branches/community/Seam_2_3/seam-reference-guide/src/docbook/en-US/Getting_Started_With_JBoss_Tools.xml
===================================================================
---
branches/community/Seam_2_3/seam-reference-guide/src/docbook/en-US/Getting_Started_With_JBoss_Tools.xml 2012-07-17
15:36:16 UTC (rev 14981)
+++
branches/community/Seam_2_3/seam-reference-guide/src/docbook/en-US/Getting_Started_With_JBoss_Tools.xml 2012-07-17
15:36:31 UTC (rev 14982)
@@ -7,7 +7,7 @@
<para>
JBoss Tools is a collection of Eclipse plugins. JBoss Tools a project
creation wizard for Seam, Content Assist for the Unified Expression
- Language (EL) in both facelets and Java code, a graphical editor for jPDL,
+ Language (EL) in both facelets and Java code,
a graphical editor for Seam configuration files, support for running Seam
integration tests from within Eclipse, and much more.
</para>
@@ -15,6 +15,10 @@
<para>
In short, if you are an Eclipse user, then you'll want JBoss Tools!
</para>
+
+ <para>Please read the latest JBoss Tools documentation at
+ <ulink
url="http://docs.jboss.org/tools/latest/en/seam/html_single/"&g...
+ </para>
<para>
JBoss Tools, as with seam-gen, works best with JBoss AS, but it's possible
@@ -27,658 +31,18 @@
<title>Before you start</title>
<para>
- Make sure you have JDK 5, JBoss AS 4.2 or 5.0, Eclipse 3.3, the JBoss
- Tools plugins (at least Seam Tools, the Visual Page Editor, jBPM Tools
- and JBoss AS Tools) and the TestNG plugin for Eclipse correctly
+ Make sure you have JDK 6, JBoss AS 7.1.1.Final, Eclipse 3.7, the JBoss
+ Tools plugins (at least Seam Tools, the Visual Page Editor
+ and JBoss AS Tools) and the JUnit plugin for Eclipse correctly
installed before starting.
</para>
<para>
Please see the official <ulink
-
url="http://www.jboss.org/tools/download/installation">JBoss Tools
- installation</ulink> page for the quickest way to get JBoss Tools setup
- in Eclipse. You can also check out the <ulink
-
url="http://www.jboss.org/community/wiki/InstallingJBossTools"&...
- JBoss Tools</ulink> page on the JBoss community wiki for the gory
- details and a set of alternative installation approaches.
+
url="http://docs.jboss.org/tools/latest/en/GettingStartedGuide/html_...
Tools
+ Getting started</ulink> page for the quickest way to get JBoss Tools
setup
+ in Eclipse.
</para>
</section>
-
- <section>
- <title>Setting up a new Seam project</title>
-
- <para>
- Start up Eclipse and select the <emphasis>Seam</emphasis>
perspective.
- </para>
-
- <para>
- Go to <emphasis>File</emphasis> ->
<emphasis>New</emphasis> ->
- <emphasis>Seam Web Project</emphasis>.
- </para>
-
- <mediaobject>
- <imageobject role="fo">
- <imagedata fileref="images/new_web_project_0.png"
- align="center" />
- </imageobject>
- <imageobject role="html">
- <imagedata fileref="images/new_web_project_0.png"
- align="center" />
- </imageobject>
- </mediaobject>
-
- <para>
- First, enter a name for your new project. For this tutorial, we're
- going to use
- <literal>helloworld</literal>
- .
- </para>
-
-
- <para>
- Now, we need to tell JBoss Tools about JBoss AS. In this example we
- are using JBoss AS 4.2, though you can certainly use JBoss AS 5.0 as
- well. Selecting JBoss AS is a two step process. First we need to
- define a runtime. Again, we'll choose JBoss AS 4.2 in this case:
- </para>
-
- <mediaobject>
- <imageobject role="fo">
- <imagedata fileref="images/new_server_runtime_1.png"
- align="center" />
- </imageobject>
- <imageobject role="html">
- <imagedata fileref="images/new_server_runtime_1.png"
- align="center" />
- </imageobject>
- </mediaobject>
-
- <para>
- Enter a name for the runtime, and locate it on your hard drive:
- </para>
-
- <mediaobject>
- <imageobject role="fo">
- <imagedata fileref="images/new_server_runtime_2.png"
- align="center" />
- </imageobject>
- <imageobject role="html">
- <imagedata fileref="images/new_server_runtime_2.png"
- align="center" />
- </imageobject>
- </mediaobject>
-
- <para>
- Next, we need to define a server JBoss Tools can deploy the project to.
- Make sure to again select JBoss AS 4.2, and also the runtime you just
- defined:
- </para>
-
- <mediaobject>
- <imageobject role="fo">
- <imagedata fileref="images/new_server_1.png"
align="center"
- />
- </imageobject>
- <imageobject role="html">
- <imagedata fileref="images/new_server_1.png"
align="center" />
- </imageobject>
- </mediaobject>
-
- <para>
- On the next screen give the server a name, and hit
- <emphasis>Finish</emphasis>:
- </para>
-
- <mediaobject>
- <imageobject role="fo">
- <imagedata fileref="images/new_server_2.png"
- align="center" />
- </imageobject>
- <imageobject role="html">
- <imagedata fileref="images/new_server_2.png"
- align="center" />
- </imageobject>
- </mediaobject>
-
- <para>
- Make sure the runtime and server you just created are selected, select
- <emphasis>Dynamic Web Project with Seam 2.0 (technology
preview)</emphasis>
- and hit <emphasis>Next</emphasis>:
- </para>
-
- <mediaobject>
- <imageobject role="fo">
- <imagedata fileref="images/new_web_project_1.png"
- align="center" scalefit="1" />
- </imageobject>
- <imageobject role="html">
- <imagedata fileref="images/new_web_project_1.png"
- align="center" />
- </imageobject>
- </mediaobject>
-
- <para>
- The next 3 screens allow you to further customize your new project, but
- for us the defaults are fine. So just hit <emphasis>Next</emphasis>
- until you reach the final screen.
- </para>
-
- <para>
- The first step here is to tell JBoss Tools about the Seam download you
- want to use. <emphasis>Add</emphasis> a new
- <emphasis>Seam Runtime</emphasis> - make sure to give it a name,
and
- select <emphasis>2.0</emphasis> as the version:
- </para>
-
- <mediaobject>
- <imageobject role="fo">
- <imagedata fileref="images/new_seam_runtime.png"
- align="center" scalefit="1" />
- </imageobject>
- <imageobject role="html">
- <imagedata fileref="images/new_seam_runtime.png"
- align="center" />
- </imageobject>
- </mediaobject>
-
- <para>
- The most important choice you need to make is between EAR deployment
- and WAR deployment of your project. EAR projects support EJB 3.0 and
- require Java EE 5. WAR projects do not support EJB 3.0, but may be
- deployed to a J2EE environment. The packaging of a WAR is also simpler
- to understand. If you installed an EJB3-ready application server like
- JBoss, choose <emphasis>EAR</emphasis>. Otherwise, choose
- <emphasis>WAR</emphasis>. We'll assume that you've chosen a
WAR
- deployment for the rest of the tutorial, but you can follow exactly the
- same steps for a EAR deployment.
- </para>
-
- <para>
- Next, select your database type. We'll assume you have MySQL installed,
- with an existing schema. You'll need to tell JBoss Tools about
- the database, select <emphasis>MySQL</emphasis> as the database,
and
- create a new connection profile. Select <emphasis>Generic JDBC
- Connection</emphasis>:
- </para>
-
- <mediaobject>
- <imageobject role="fo">
- <imagedata fileref="images/new_connection_profile_1.png"
- align="center" />
- </imageobject>
- <imageobject role="html">
- <imagedata fileref="images/new_connection_profile_1.png"
- align="center" />
- </imageobject>
- </mediaobject>
-
- <para>
- Give it a name:
- </para>
-
- <mediaobject>
- <imageobject role="fo">
- <imagedata fileref="images/new_connection_profile_2.png"
- align="center" scalefit="1" />
- </imageobject>
- <imageobject role="html">
- <imagedata fileref="images/new_connection_profile_2.png"
- align="center" />
- </imageobject>
- </mediaobject>
-
- <para>
- JBoss Tools doesn't come with drivers for any databases, so you need to
- tell JBoss Tools where the MySQL JDBC driver is. Tell it about the
- driver by clicking <emphasis>...</emphasis>.
- </para>
-
- <para>
- Locate MySQL 5, and hit <emphasis>Add...</emphasis>:
- </para>
-
- <mediaobject>
- <imageobject role="fo">
- <imagedata fileref="images/new_connection_profile_3.png"
- align="center" scalefit="1" />
- </imageobject>
- <imageobject role="html">
- <imagedata fileref="images/new_connection_profile_3.png"
- align="center" />
- </imageobject>
- </mediaobject>
-
- <para>
- Choose the <emphasis>MySQL JDBC Driver</emphasis> template:
- </para>
-
- <mediaobject>
- <imageobject role="fo">
- <imagedata fileref="images/new_connection_profile_4.png"
- align="center" scalefit="1" />
- </imageobject>
- <imageobject role="html">
- <imagedata fileref="images/new_connection_profile_4.png"
- align="center" />
- </imageobject>
- </mediaobject>
-
- <para>
- Locate the jar on your computer by choosing <emphasis>Edit
- Jar/Zip</emphasis>:
- </para>
-
- <mediaobject>
- <imageobject role="fo">
- <imagedata fileref="images/new_connection_profile_5.png"
- align="center" scalefit="1" />
- </imageobject>
- <imageobject role="html">
- <imagedata fileref="images/new_connection_profile_5.png"
- align="center" />
- </imageobject>
- </mediaobject>
-
- <para>
- Review the username and password used to connect, and if correct, hit
- <emphasis>Ok</emphasis>.
- </para>
-
- <para>
- Finally, choose the newly created driver:
- </para>
-
- <mediaobject>
- <imageobject role="fo">
- <imagedata fileref="images/new_connection_profile_6.png"
- align="center" scalefit="1" />
- </imageobject>
- <imageobject role="html">
- <imagedata fileref="images/new_connection_profile_6.png"
- align="center" />
- </imageobject>
- </mediaobject>
-
- <para>
- If you are working with an existing data model, make sure you tell
- JBoss Tools that the tables already exist in the database.
- </para>
-
- <para>
- Review the username and password used to connect, test the connection
- using the <emphasis>Test Connection</emphasis> button, and if it
works,
- hit <emphasis>Finish</emphasis>:
- </para>
-
- <para>
- Finally, review the package names for your generated beans, and if you
- are happy, click <emphasis>Finish</emphasis>:
- </para>
-
- <mediaobject>
- <imageobject role="fo">
- <imagedata fileref="images/new_web_project_2.png"
- align="center" scalefit="1" />
- </imageobject>
- <imageobject role="html">
- <imagedata fileref="images/new_web_project_2.png"
- align="center" />
- </imageobject>
- </mediaobject>
-
- <para>
- JBoss has sophisticated support for hot re-deployment of WARs and EARs.
- Unfortunately, due to bugs in the JVM, repeated redeployment of an
- EAR—which is common during development—eventually causes the JVM to run
- out of perm gen space. For this reason, we recommend running JBoss in a
- JVM with a large perm gen space at development time. We suggest the
- following values:
- </para>
-
- <programlisting>
- -Xms512m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512
- </programlisting>
-
- <para>
- If you don't have so much memory available, the following is our
- minimum recommendation:
- </para>
-
- <programlisting>
- -Xms256m -Xmx512m -XX:PermSize=128m -XX:MaxPermSize=256
- </programlisting>
-
- <para>
- Locate the server in the <emphasis>JBoss Server View</emphasis>,
right
- click on the server and select <emphasis>Edit Launch
- Configuration</emphasis>:
- </para>
-
- <mediaobject>
- <imageobject role="fo">
- <imagedata fileref="images/server_properties_0.png"
- align="center" />
- </imageobject>
- <imageobject role="html">
- <imagedata fileref="images/server_properties_0.png"
- align="center" />
- </imageobject>
- </mediaobject>
-
- <para>
- Then, alter the VM arguments:
- </para>
-
- <mediaobject>
- <imageobject role="fo">
- <imagedata fileref="images/server_properties.png"
- align="center" scalefit="1" />
- </imageobject>
- <imageobject role="html">
- <imagedata fileref="images/server_properties.png"
- align="center" />
- </imageobject>
- </mediaobject>
-
- <para>
- If you don't want to bother with this stuff now, you don't have to—come
- back to it later, when you get your first
- <literal>OutOfMemoryException</literal>.
- </para>
-
- <para>
- To start JBoss, and deploy the project, just right click on the server
- you created, and click <emphasis>Start</emphasis>, (or
- <emphasis>Debug</emphasis> to start in debug mode):
- </para>
-
- <mediaobject>
- <imageobject role="fo">
- <imagedata fileref="images/start_server.png"
- align="center" />
- </imageobject>
- <imageobject role="html">
- <imagedata fileref="images/start_server.png"
- align="center" />
- </imageobject>
- </mediaobject>
-
- <para>
- Don't get scared by the XML configuration documents that were generated
- into the project directory. They are mostly standard Java EE stuff, the
- stuff you need to create once and then never look at again, and they
- are 90% the same between all Seam projects.
- </para>
-
- </section>
-
- <section>
- <title>Creating a new action</title>
-
- <para>
- If you're used to traditional action-style web frameworks, you're
- probably wondering how you can create a simple web page with a
- stateless action method in Java.
- </para>
-
- <para>
- First, select <emphasis>New</emphasis> -> <emphasis>Seam
Action</emphasis>:
- </para>
-
- <mediaobject>
- <imageobject role="fo">
- <imagedata fileref="images/new_action_0.png"
- align="center" />
- </imageobject>
- <imageobject role="html">
- <imagedata fileref="images/new_action_0.png"
- align="center" />
- </imageobject>
- </mediaobject>
-
- <para>
- Now, enter the name of the Seam component. JBoss Tools selects sensible
- defaults for other fields:
- </para>
-
- <mediaobject>
- <imageobject role="fo">
- <imagedata fileref="images/new_action_1.png"
- align="center" />
- </imageobject>
- <imageobject role="html">
- <imagedata fileref="images/new_action_1.png"
- align="center" />
- </imageobject>
- </mediaobject>
-
- <para>
- Finally, hit <emphasis>Finish</emphasis>.
- </para>
-
- <para>
- Now go to
<literal>http://localhost:8080/helloworld/ping.seam</literal>
- and click the button. You can see the code behind this action by
- looking in the project <literal>src</literal> directory. Put a
- breakpoint in the <literal>ping()</literal> method, and click the
- button again.
- </para>
-
- <para>
- Finally, open the <literal>helloworld-test</literal> project,
locate
- <literal>PingTest</literal> class, right click on it, and choose
- <emphasis>Run As</emphasis> -> <emphasis>TestNG
Test</emphasis>:
- </para>
-
- <mediaobject>
- <imageobject role="fo">
- <imagedata fileref="images/run_test.png"
- align="center" scalefit="1" />
- </imageobject>
- <imageobject role="html">
- <imagedata fileref="images/run_test.png"
- align="center" />
- </imageobject>
- </mediaobject>
-
- </section>
-
- <section>
- <title>Creating a form with an action</title>
-
- <para>
- The first step is to create a form. Select <emphasis>New</emphasis>
->
- <emphasis>Seam Form</emphasis>:
- </para>
-
- <mediaobject>
- <imageobject role="fo">
- <imagedata fileref="images/new_form_0.png"
- align="center" scalefit="1" />
- </imageobject>
- <imageobject role="html">
- <imagedata fileref="images/new_form_0.png"
- align="center" />
- </imageobject>
- </mediaobject>
-
- <para>
- Now, enter the name of the Seam component. JBoss Tools selects sensible
- defaults for other fields:
- </para>
-
- <mediaobject>
- <imageobject role="fo">
- <imagedata fileref="images/new_form_1.png"
- align="center" />
- </imageobject>
- <imageobject role="html">
- <imagedata fileref="images/new_form_1.png"
- align="center" />
- </imageobject>
- </mediaobject>
-
- <para>
- Go to
<literal>http://localhost:8080/helloworld/hello.seam</literal>.
- Then take a look at the generated code. Run the test. Try adding some
- new fields to the form and Seam component (note, you don't need to
- restart the app server each time you change the code in
- <literal>src/action</literal> as Seam hot reloads the component for
- you <xref linkend="gettingstartedwithjbosstools.hotdeployment"
/>).
- </para>
- </section>
-
- <section>
- <title>Generating an application from an existing database</title>
-
- <para>
- Manually create some tables in your database. (If you need to switch to
- a different database, create a new project, and select the correct
- database). Then, select <emphasis>New</emphasis> ->
- <emphasis>Seam Generate Entities</emphasis>:
- </para>
-
- <mediaobject>
- <imageobject role="fo">
- <imagedata fileref="images/generate_entities_0.png"
- align="center" scalefit="1" />
- </imageobject>
- <imageobject role="html">
- <imagedata fileref="images/generate_entities_0.png"
- align="center" />
- </imageobject>
- </mediaobject>
-
- <para>
- JBoss Tools gives you the option to either reverse engineer
- entities, components and views from a database schema or to reverse
- engineer components and views from existing JPA entities. We're going
- to do <emphasis>reverse engineering from database</emphasis>.
- </para>
-
- <para>
- Restart the deployment:
- </para>
-
- <mediaobject>
- <imageobject role="fo">
- <imagedata fileref="images/restart_deployment.png"
- align="center" />
- </imageobject>
- <imageobject role="html">
- <imagedata fileref="images/restart_deployment.png"
- align="center" />
- </imageobject>
- </mediaobject>
-
- <para>
- Then go to <literal>http://localhost:8080/helloworld</literal>. You
can
- browse the database, edit existing objects, and create new objects. If
- you look at the generated code, you'll probably be amazed how simple it
- is! Seam was designed so that data access code is easy to write by
- hand, even for people who don't want to cheat by using reverse
- engineering.
- </para>
- </section>
-
- <section id="gettingstartedwithjbosstools.hotdeployment">
- <title>Seam and incremental hot deployment with JBoss Tools</title>
-
- <para>
- JBoss Tools supports incremental hot deployment of:
- </para>
-
- <itemizedlist>
- <listitem>
- <para>any facelets page</para>
- </listitem>
-
- <listitem>
- <para>
- any <literal>pages.xml</literal> file
- </para>
- </listitem>
- </itemizedlist>
-
- <para>
- out of the box.
- </para>
-
- <para>
- But if we want to change any Java code, we still need to do a full
- restart of the application by doing a
- <emphasis>Full Publish</emphasis>.
- </para>
-
- <para>
- But if you really want a fast edit/compile/test cycle, Seam supports
- incremental redeployment of JavaBean components. To make use of this
- functionality, you must deploy the JavaBean components into the
- <literal>WEB-INF/dev</literal> directory, so that they will be
loaded
- by a special Seam classloader, instead of by the WAR or EAR
- classloader.
- </para>
-
- <para>You need to be aware of the following limitations:</para>
-
- <itemizedlist>
- <listitem>
- <para>
- the components must be JavaBean components, they cannot be EJB3
- beans (we are working on fixing this limitation)
- </para>
- </listitem>
-
- <listitem>
- <para>
- entities can never be hot-deployed
- </para>
- </listitem>
-
- <listitem>
- <para>
- components deployed via <literal>components.xml</literal> may
not
- be hot-deployed
- </para>
- </listitem>
-
- <listitem>
- <para>
- the hot-deployable components will not be visible to any classes
- deployed outside of <literal>WEB-INF/dev</literal>
- </para>
- </listitem>
-
- <listitem>
- <para>
- Seam debug mode must be enabled and
- <literal>jboss-seam-debug.jar</literal> must be in
- <literal>WEB-INF/lib</literal>
- </para>
- </listitem>
-
- <listitem>
- <para>
- You must have the Seam filter installed in web.xml
- </para>
- </listitem>
-
- <listitem>
- <para>
- You may see errors if the system is placed under any load and
- debug is enabled.
- </para>
- </listitem>
-
- </itemizedlist>
-
- <para>
- If you create a WAR project using JBoss Tools, incremental hot deployment
- is available out of the box for classes in the
- <literal>src/action</literal> source directory. However, JBoss Tools
- does not support incremental hot deployment for EAR projects.
- </para>
- </section>
-
</chapter>
Modified:
branches/community/Seam_2_3/seam-reference-guide/src/docbook/en-US/Gettingstarted.xml
===================================================================
---
branches/community/Seam_2_3/seam-reference-guide/src/docbook/en-US/Gettingstarted.xml 2012-07-17
15:36:16 UTC (rev 14981)
+++
branches/community/Seam_2_3/seam-reference-guide/src/docbook/en-US/Gettingstarted.xml 2012-07-17
15:36:31 UTC (rev 14982)
@@ -24,9 +24,9 @@
<section>
<title>Before you start</title>
- <para>Make sure you have JDK 5 or JDK 6 (see <xref
- linkend="jdk_dependencies"/> for details), JBoss AS 4.2 or 5.0
and Ant 1.7.0, along with recent versions of
- Eclipse, the JBoss IDE plugin for Eclipse and the TestNG plugin for Eclipse
correctly installed before
+ <para>Make sure you have JDK 6 (see <xref
+ linkend="jdk_dependencies"/> for details), JBoss AS 7.1.1 and
Maven 3.x, along with recent versions of
+ Eclipse, the JBoss IDE plugin for Eclipse correctly installed before
starting. Add your JBoss installation to the JBoss Server View in Eclipse.
Start JBoss in debug mode.
Finally, start a command prompt in the directory where you unzipped the Seam
distribution.</para>
@@ -43,7 +43,7 @@
<programlisting>-Xms256m -Xmx512m -XX:PermSize=128m
-XX:MaxPermSize=256m</programlisting>
<para>If you're running JBoss from the command line, you can configure
the JVM options in
- <literal>bin/run.conf</literal>.</para>
+ <literal>bin/standalone.conf</literal>.</para>
<para>If you don't want to bother with this stuff now, you don't
have to—come back to it later, when you get
your first <literal>OutOfMemoryException</literal>.</para>
@@ -55,7 +55,7 @@
<para>The first thing we need to do is configure seam-gen for your
environment: JBoss AS installation directory,
project workspace, and database connection. It's easy, just
type:</para>
- <programlisting>cd jboss-seam-2.2.x
+ <programlisting>cd jboss-seam-2.3.0
seam setup</programlisting>
<para>And you will be prompted for the needed information:</para>
@@ -69,12 +69,12 @@
[echo] Welcome to seam-gen :-)
[input] Enter your project workspace (the directory that contains your Seam projects)
[C:/Projects] [C:/Projects]
/Users/pmuir/workspace
- [input] Enter your JBoss home directory [C:/Program Files/jboss-4.2.3.GA] [C:/Program
Files/jboss-4.2.3.GA]
-/Applications/jboss-4.2.3.GA
+ [input] Enter your JBoss AS home directory [C:/Program Files/jboss-as-7.1.1.Final]
[C:/Program Files/jboss-as-7.1.1.Final]
+/Applications/jboss-as-7.1.1.Final
[input] Enter the project name [myproject] [myproject]
helloworld
[echo] Accepted project name as: helloworld
- [input] Select a RichFaces skin (not applicable if using ICEFaces) [blueSky]
([blueSky], classic, ruby, wine, deepMarine, emeraldTown, sakura, DEFAULT)
+ [input] Select a RichFaces skin [blueSky] ([blueSky], emeraldTown, ruby, classic,
japanCherry, wine, deepMarine, DEFAULT, plain)
[input] Is this project deployed as an EAR (with EJB components) or a WAR (with no
EJB support) [ear] ([ear], war, )
@@ -84,7 +84,7 @@
[input] Enter the Java package name for your test cases [org.jboss.helloworld.test]
[org.jboss.helloworld.test]
- [input] What kind of database are you using? [hsql] ([hsql], mysql, oracle,
postgres, mssql, db2, sybase, enterprisedb, h2)
+ [input] What kind of database are you using? [h2] ([h2], hsql, mysql, oracle,
postgres, mssql, db2, sybase, enterprisedb)
mysql
[input] Enter the Hibernate dialect for your database
[org.hibernate.dialect.MySQLDialect] [org.hibernate.dialect.MySQLDialect]
@@ -104,8 +104,7 @@
[input] Are you working with tables that already exist in the database? [n] (y, [n],
)
y
[input] Do you want to drop and recreate the database tables and data in import.sql
each time you deploy? [n] (y, [n], )
-n
- [input] Enter your ICEfaces home directory (leave blank to omit ICEfaces) [] []
+n
[propertyfile] Creating new property file:
/Users/pmuir/workspace/jboss-seam/seam-gen/build.properties
[echo] Installing JDBC driver jar to JBoss server
@@ -157,7 +156,7 @@
(<literal>helloworld</literal> in this case), and then
clicking <literal>Finish</literal>. Do not select
<literal>Java Project</literal> from the New Project
wizard.</para>
- <para>If your default JDK in Eclipse is not a Java SE 5 or Java SE 6 JDK,
you will need to select a Java SE 5
+ <para>If your default JDK in Eclipse is not a Java SE 6 JDK, you will need
to select a Java SE 6
compliant JDK using <literal>Project -> Properties ->
Java Compiler</literal>.</para>
<para>Alternatively, you can deploy the project from outside Eclipse by
typing <literal>seam explode</literal>.</para>
@@ -407,41 +406,4 @@
incremental hot deployment for EAR projects.</para>
</section>
- <section>
- <title>Using Seam with JBoss 4.0</title>
-
- <para> Seam 2 was developed for JavaServer Faces 1.2. When using JBoss AS,
we recommend using JBoss 4.2 or
- JBoss 5.0, both of which bundle the JSF 1.2 reference implementation.
However, it is still possible to use
- Seam 2 on the JBoss 4.0 platform. There are two basic steps required to do
this: install an EJB3-enabled
- version of JBoss 4.0 and replace MyFaces with the JSF 1.2 reference
implementation. Once you complete these
- steps, Seam 2 applications can be deployed to JBoss 4.0.</para>
-
- <section>
- <title>Install JBoss 4.0</title>
- <para>JBoss 4.0 does not ship a default configuration compatible with
Seam. To run Seam, you must install
- JBoss 4.0.5 using the JEMS 1.2 installer with the ejb3 profile selected.
Seam will not run with an
- installation that doesn't include EJB3 support. The JEMS installer
can be downloaded from <ulink
-
url="http://www.jboss.org/jbossas/downloads"
- >http://www.jboss.org/jbossas/downloads</ulink>. </para>
- </section>
-
- <section>
- <title>Install the JSF 1.2 RI</title>
-
- <para> The web configuration for JBoss 4.0 can be found in the
-
<literal>server/default/deploy/jbossweb-tomcat55.sar</literal>. You'll
need to delete
- <literal>myfaces-api.jar</literal> any
<literal>myfaces-impl.jar</literal> from the
- <literal>jsf-libs </literal>directory. Then, you'll
need to copy <literal>jsf-api.jar</literal>,
- <literal>jsf-impl.jar</literal>,
<literal>el-api.jar</literal>, and <literal>el-ri.jar</literal>
- to that directory. The JSF JARs can be found in the Seam
<literal>lib</literal> directory. The el JARs
- can be obtained from the Seam 1.2 release. </para>
-
- <para>You'll also need to edit the
<literal>conf/web.xml</literal>, replacing
- <literal>myfaces-impl.jar</literal> with
<literal>jsf-impl.jar</literal>. </para>
- </section>
-
-
-
- </section>
-
</chapter>
Modified: branches/community/Seam_2_3/seam-reference-guide/src/docbook/en-US/Gwt.xml
===================================================================
--- branches/community/Seam_2_3/seam-reference-guide/src/docbook/en-US/Gwt.xml 2012-07-17
15:36:16 UTC (rev 14981)
+++ branches/community/Seam_2_3/seam-reference-guide/src/docbook/en-US/Gwt.xml 2012-07-17
15:36:31 UTC (rev 14982)
@@ -172,13 +172,12 @@
<section>
<title>GWT Ant Targets</title>
-
<para>
For deployment of GWT apps, there is a compile-to-Javascript step (which compacts
and obfuscates the code). There is an
ant utility which can be used instead of the command line or GUI utility that GWT
provides. To use this, you will need
to have the ant task jar in your ant classpath, as well as GWT downloaded (which
you will need for hosted mode anyway).
- </para>
-
+ </para>
+
<para>
Then, in your ant file, place (near the top of your ant file):
</para>
@@ -229,6 +228,54 @@
you can't or won't use the hosted mode browser, I would go far as to say
you should NOT be using GWT at all - it's
that valuable!).
</para>
+
+ </section>
+
+
+ <section>
+ <title>GWT Maven plugin</title>
+
+ <para>
+ For a deployment of GWT apps, there is a set of maven GWT goals which does
everything what GWT supports. The
+ maven-gwt-plugin usage is in more
+ details at <ulink
url="http://mojo.codehaus.org/gwt-maven-plugin/">GWT </ulink>.
+ </para>
+ <para>
+ Basic set up is for instance here:
+ </para>
+ <programlisting>
+ <![CDATA[ <build>
+ <plugins>
+ [...]
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>gwt-maven-plugin</artifactId>
+ <version>1.2</version> <!-- version 1.2 allows us to
specify gwt version by gwt-user dependency -->
+ <configuration>
+
<generateDirectory>${project.build.outoutDirectory}/${project.build.finalName}</generateDirectory>
+ <inplace>false</inplace>
+ <logLevel>TRACE</logLevel>
+ <extraJvmArgs>-Xmx512m -DDEBUG</extraJvmArgs>
+ <soyc>false</soyc>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>resources</goal>
+ <goal>compile</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ [...]
+ </plugins>
+ [...]
+ </build>]]>
+ </programlisting>
+ <para>
+ More can be seen here
+ <ulink
url="http://mojo.codehaus.org/gwt-maven-plugin/user-guide/compile.ht...
+ </para>
</section>
</chapter>
Modified: branches/community/Seam_2_3/seam-reference-guide/src/docbook/en-US/I18n.xml
===================================================================
--- branches/community/Seam_2_3/seam-reference-guide/src/docbook/en-US/I18n.xml 2012-07-17
15:36:16 UTC (rev 14981)
+++ branches/community/Seam_2_3/seam-reference-guide/src/docbook/en-US/I18n.xml 2012-07-17
15:36:31 UTC (rev 14982)
@@ -1,430 +1,337 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
-"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd">
+<?xml version='1.0'?>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd">
<chapter id="i18n">
- <title>Internationalization, localization and themes</title>
-
- <para>
- Seam makes it easy to build internationalized applications. First, let's
- walk through all the stages needed to internationalize and localize your
- app. Then we'll take a look at the components Seam bundles.
- </para>
-
- <section>
- <title>Internationalizing your app</title>
-
- <para>
- A JEE application consists of many components and all of them must be
- configured properly for your application to be localized.
- </para>
-
- <note>
- <para> Note that all i18n features in Seam work only in JSF
context.</para>
- </note>
-
- <para>
- Starting at the bottom, the first step is to ensure that your database
- server and client is using the correct character encoding for your
- locale. Normally you'll want to use UTF-8. How to do this is outside
- the scope of this tutorial.
- </para>
-
- <section>
- <title>Application server configuration</title>
-
- <para>
- To ensure that the application server receives the request
- parameters in the correct encoding from client requests you have to
- configure the tomcat connector. If you use Tomcat or JBoss AS, add
- the <literal>URIEncoding="UTF-8"</literal> attribute to
the
- connector configuration. For JBoss AS 4.2 change
-
<literal>${JBOSS_HOME}/server/(default)/deploy/jboss-web.deployer/server.xml</literal>:
- </para>
-
- <programlisting role="XML"><Connector
port="8080" URIEncoding="UTF-8"/></programlisting>
-
- <para>
- There is alternative which is probably better. You can tell JBoss AS
- that the encoding for the request parameters will be taken from the
- request:
- </para>
-
- <programlisting role="XML"><Connector
port="8080"
useBodyEncodingForURI="true"/></programlisting>
- </section>
-
- <section>
- <title>Translated application strings</title>
-
- <para>
- You'll also need localized strings for all the
<emphasis>messages</emphasis>
- in your application (for example field labels on your views). First
- you need to ensure that your resource bundle is encoded using the
- desired character encoding. By default ASCII is used. Although ASCII
- is enough for many languages, it doesn't provide characters for all
- languages.
- </para>
-
- <para>
- Resource bundles must be created in ASCII, or use Unicode escape
- codes to represent Unicode characters. Since you don't compile a
- property file to byte code, there is no way to tell the JVM which
- character set to use. So you must use either ASCII characters or
- escape characters not in the ASCII character set.
- You can represent a Unicode character in any Java file using \uXXXX,
- where XXXX is the hexadecimal representation of the character.
- </para>
-
- <para>
- You can write your translation of labels
- (<xref linkend="labels"/>) to your messages resource
- bundle in the native encoding and then convert the content of the
- file into the escaped format through the tool
<literal>native2ascii</literal>
- provided in the JDK. This tool will convert a file written in your
- native encoding to one that represents non-ASCII characters as
- Unicode escape sequences.
- </para>
-
- <para>
- Usage of this tool is described
- <ulink
url="http://java.sun.com/j2se/1.5.0/docs/tooldocs/index.html#intl&qu... for
Java 5</ulink>
- or
- <ulink
url="http://java.sun.com/javase/6/docs/technotes/tools/#intl"&g... for Java
6</ulink>.
- For example, to convert a file from UTF-8:
- </para>
-
- <programlisting><prompt>$ native2ascii -encoding UTF-8
messages_cs.properties >
messages_cs_escaped.properties</prompt></programlisting>
-
- </section>
-
- <section>
- <title>Other encoding settings</title>
-
- <para>
- We need to make sure that the view displays your localized data and
- messages using the correct character set and also any data submitted
- uses the correct encoding.
- </para>
-
- <para>
- To set the display character encoding, you need to use the
- <literal><f:view
locale="cs_CZ"/></literal> tag (here we tell
- JSF to use the Czech locale). You may want to change the encoding of
- the xml document itself if you want to embed localized strings in the
- xml. To do this alter the encoding attribute in xml declaration
- <literal><?xml version="1.0"
encoding="UTF-8"?></literal> as
- required.
- </para>
-
- <para>
- Also JSF/Facelets should submit any requests using the specified
- character encoding, but to make sure any requests that don't specify
- an encoding you can force the request encoding using a servlet
- filter. Configure this in <literal>components.xml</literal>:
- </para>
-
- <programlisting
role="XML"><![CDATA[<web:character-encoding-filter
encoding="UTF-8"
- override-client="true"
- url-pattern="*.seam" />]]></programlisting>
- </section>
- </section>
-
- <section id="locales">
- <title>Locales</title>
-
- <para>Each user login session has an associated instance of
- <literal>java.util.Locale</literal> (available to the application as a
- component named <literal>locale</literal>). Under normal circumstances,
- you won't need to do any special configuration to set the locale. Seam
- just delegates to JSF to determine the active locale:</para>
-
- <itemizedlist>
- <listitem>
- <para>If there is a locale associated with the HTTP request (the
- browser locale), and that locale is in the list of supported locales
- from <literal>faces-config.xml</literal>, use that locale for the
rest
- of the session.</para>
- </listitem>
-
- <listitem>
- <para>Otherwise, if a default locale was specified in the
- <literal>faces-config.xml</literal>, use that locale for the rest of
- the session.</para>
- </listitem>
-
- <listitem>
- <para>Otherwise, use the default locale of the server.</para>
- </listitem>
- </itemizedlist>
-
- <para>It is <emphasis>possible</emphasis> to set the locale
manually via
- the Seam configuration properties <literal>
- org.jboss.seam.international.localeSelector.language</literal>,
<literal>
- org.jboss.seam.international.localeSelector.country</literal> and
- <literal> org.jboss.seam.international.localeSelector.variant</literal>,
- but we can't think of any good reason to ever do this.</para>
-
- <para>It is, however, useful to allow the user to set the locale manually
- via the application user interface. Seam provides built-in functionality
- for overriding the locale determined by the algorithm above. All you have
- to do is add the following fragment to a form in your JSP or Facelets
- page:</para>
-
- <programlisting role="XHTML"><h:selectOneMenu
value="#{localeSelector.language}">
- <f:selectItem itemLabel="English" itemValue="en"/>
- <f:selectItem itemLabel="Deutsch" itemValue="de"/>
- <f:selectItem itemLabel="Francais"
itemValue="fr"/>
+ <title>Internationalization, localization and themes</title>
+ <para>Seam makes it easy to build internationalized applications.
+ First, let's walk through all the stages needed to
+ internationalize and localize your app. Then we'll take a look at
+ the components Seam bundles.</para>
+ <section>
+ <title>Internationalizing your app</title>
+ <para>A JEE application consists of many components and all of them
+ must be configured properly for your application to be
+ localized.</para>
+ <note>
+ <para>Note that all i18n features in Seam work only in JSF
+ context.</para>
+ </note>
+ <para>Starting at the bottom, the first step is to ensure that your
+ database server and client is using the correct character encoding
+ for your locale. Normally you'll want to use UTF-8. How to do
+ this is outside the scope of this tutorial.</para>
+ <section>
+ <title>Application server configuration</title>
+ <para>To ensure that the application server receives the request
+ parameters in the correct encoding from client requests you have to
+ configure the tomcat connector. If you use JBoss AS, add the system
+ properties <property>
+ org.apache.catalina.connector.URI_ENCODING</property> and <property>
+ org.apache.catalina.connector.USE_BODY_ENCODING_FOR_QUERY_STRING</property>
+ to the server configuration. For JBoss AS 7.1.1 change <filename>
+ ${JBOSS_HOME}/standalone/configuration/standalone.xml</filename>:</para>
+ <programlisting role="XML">
+<system-properties>
+ <property name="org.apache.catalina.connector.URI_ENCODING"
value="UTF-8"/>
+ <property
name="org.apache.catalina.connector.USE_BODY_ENCODING_FOR_QUERY_STRING"
value="true"/>
+</system-properties>
+ </programlisting>
+ </section>
+ <section>
+ <title>Translated application strings</title>
+ <para>You'll also need localized strings for all the <emphasis>
+ messages</emphasis> in your application (for example field labels on
+ your views). First you need to ensure that your resource bundle is
+ encoded using the desired character encoding. By default ASCII is
+ used. Although ASCII is enough for many languages, it doesn't
+ provide characters for all languages.</para>
+ <para>Resource bundles must be created in ASCII, or use Unicode
+ escape codes to represent Unicode characters. Since you don't
+ compile a property file to byte code, there is no way to tell the
+ JVM which character set to use. So you must use either ASCII
+ characters or escape characters not in the ASCII character set. You
+ can represent a Unicode character in any Java file using \uXXXX,
+ where XXXX is the hexadecimal representation of the character.</para>
+ <para>You can write your translation of labels (
+ <xref linkend="labels"/>) to your messages resource bundle in the
+ native encoding and then convert the content of the file into the
+ escaped format through the tool <literal>native2ascii</literal>
+ provided in the JDK. This tool will convert a file written in your
+ native encoding to one that represents non-ASCII characters as
+ Unicode escape sequences.</para>
+ <para>Usage of this tool is described
+ <ulink
url="http://java.sun.com/j2se/1.5.0/docs/tooldocs/index.html#intl&qu...
+ here for Java 5</ulink> or
+ <ulink
url="http://java.sun.com/javase/6/docs/technotes/tools/#intl">
+ here for Java 6</ulink>. For example, to convert a file from
+ UTF-8:</para>
+ <programlisting><prompt>$ native2ascii -encoding UTF-8
messages_cs.properties >
messages_cs_escaped.properties</prompt></programlisting>
+ </section>
+ <section>
+ <title>Other encoding settings</title>
+ <para>We need to make sure that the view displays your localized
+ data and messages using the correct character set and also any data
+ submitted uses the correct encoding.</para>
+ <para>To set the display character encoding, you need to use the
+ <literal><f:view
locale="cs_CZ"/></literal> tag
+ (here we tell JSF to use the Czech locale). You may want to change
+ the encoding of the xml document itself if you want to embed
+ localized strings in the xml. To do this alter the encoding
+ attribute in xml declaration <literal><?xml
+ version="1.0"
encoding="UTF-8"?></literal> as
+ required.</para>
+ <para>Also JSF/Facelets should submit any requests using the
+ specified character encoding, but to make sure any requests that
+ don't specify an encoding you can force the request encoding
+ using a servlet filter. Configure this in <literal>
+ components.xml</literal>:</para>
+ <programlisting role="XML"><web:character-encoding-filter
encoding="UTF-8"
+ override-client="true"
+ url-pattern="*.seam" /></programlisting>
+ </section>
+ </section>
+ <section id="locales">
+ <title>Locales</title>
+ <para>Each user login session has an associated instance of <literal>
+ java.util.Locale</literal> (available to the application as a
+ component named <literal>locale</literal>). Under normal
+ circumstances, you won't need to do any special configuration to
+ set the locale. Seam just delegates to JSF to determine the active
+ locale:</para>
+ <itemizedlist>
+ <listitem>
+ <para>If there is a locale associated with the HTTP request (the
+ browser locale), and that locale is in the list of supported
+ locales from <literal>faces-config.xml</literal>, use that locale
+ for the rest of the session.</para>
+ </listitem>
+ <listitem>
+ <para>Otherwise, if a default locale was specified in the <literal>
+ faces-config.xml</literal>, use that locale for the rest of the
+ session.</para>
+ </listitem>
+ <listitem>
+ <para>Otherwise, use the default locale of the server.</para>
+ </listitem>
+ </itemizedlist>
+ <para>It is <emphasis>possible</emphasis> to set the locale manually
+ via the Seam configuration properties <literal>
+ org.jboss.seam.international.localeSelector.language</literal>,
+ <literal>
+ org.jboss.seam.international.localeSelector.country</literal> and
+ <literal>
+ org.jboss.seam.international.localeSelector.variant</literal>, but we
+ can't think of any good reason to ever do this.</para>
+ <para>It is, however, useful to allow the user to set the locale
+ manually via the application user interface. Seam provides built-in
+ functionality for overriding the locale determined by the algorithm
+ above. All you have to do is add the following fragment to a form in
+ your JSP or Facelets page:</para>
+ <programlisting role="XHTML"><h:selectOneMenu
value="#{localeSelector.language}">
+ <f:selectItem itemLabel="English"
itemValue="en"/>
+ <f:selectItem itemLabel="Deutsch"
itemValue="de"/>
+ <f:selectItem itemLabel="Francais"
itemValue="fr"/>
</h:selectOneMenu>
-<h:commandButton action="#{localeSelector.select}"
-
value="#{messages['ChangeLanguage']}"/></programlisting>
-
- <para>Or, if you want a list of all supported locales from <literal>
- faces-config.xml</literal>, just use:</para>
-
- <programlisting role="XHTML"><h:selectOneMenu
value="#{localeSelector.localeString}">
- <f:selectItems value="#{localeSelector.supportedLocales}"/>
+<h:commandButton action="#{localeSelector.select}"
+
value="#{messages['ChangeLanguage']}"/></programlisting>
+ <para>Or, if you want a list of all supported locales from <literal>
+ faces-config.xml</literal>, just use:</para>
+ <programlisting role="XHTML"><h:selectOneMenu
value="#{localeSelector.localeString}">
+ <f:selectItems
value="#{localeSelector.supportedLocales}"/>
</h:selectOneMenu>
-<h:commandButton action="#{localeSelector.select}"
-
value="#{messages['ChangeLanguage']}"/></programlisting>
-
- <para>When the user selects an item from the drop-down, then clicks the
- command button, the Seam and JSF locales will be overridden for the rest of the
- session.</para>
-
- <para>The brings us to the question of where the supported locales are
- defined. Typically, you provide a list of locales for which you have
- matching resource bundles in the
<literal><locale-config></literal>
- element of the JSF configuration file (/META-INF/faces-config.xml). However,
- you have learned to appreciate that Seam's component configuration
- mechanism is more powerful than what is provided in Java EE. For that
- reason, you can configure the supported locales, and the default locale of
- the server, using the built-in component named
- <literal>org.jboss.seam.international.localeConfig</literal>. To use it,
- you first declare an XML namespace for Seam's international package in the
- Seam component descriptor. You then define the default locale and supported
- locales as follows:</para>
-
- <programlisting role="XML"><international:locale-config
default-locale="fr_CA" supported-locales="en fr_CA
fr_FR"/></programlisting>
-
- <para>Naturally, if you pronounce that you support a locale, you better
- provide a resource bundle to match it! Up next, you'll learn how to define
- the language-specific labels.</para>
- </section>
-
- <section id="labels" >
- <title>Labels</title>
-
- <para>JSF supports internationalization of user interface labels and
- descriptive text via the use of <literal><f:loadBundle
/></literal>.
- You can use this approach in Seam applications. Alternatively, you can
- take advantage of the Seam <literal> messages</literal> component to
- display templated labels with embedded EL expressions.</para>
-
- <section>
- <title>Defining labels</title>
-
- <para>Seam provides a
<literal>java.util.ResourceBundle</literal>
- (available to the application as a <literal>
- org.jboss.seam.core.resourceBundle</literal>). You'll need to make your
- internationalized labels available via this special resource bundle. By
- default, the resource bundle used by Seam is named
- <literal>messages</literal> and so you'll need to define your
labels in
- files named <literal> messages.properties</literal>, <literal>
- messages_en.properties</literal>, <literal>
- messages_en_AU.properties</literal>, etc. These files usually belong in
- the <literal>WEB-INF/classes</literal> directory.</para>
-
- <para>So, in
<literal>messages_en.properties</literal>:</para>
-
- <programlisting>Hello=Hello</programlisting>
-
- <para>And in
<literal>messages_en_AU.properties</literal>:</para>
-
- <programlisting>Hello=G'day</programlisting>
-
- <para>You can select a different name for the resource bundle by setting
- the Seam configuration property named <literal>
- org.jboss.seam.core.resourceLoader.bundleNames</literal>. You can even
- specify a list of resource bundle names to be searched (depth first) for
- messages.</para>
-
- <programlisting role="XML"><core:resource-loader>
+<h:commandButton action="#{localeSelector.select}"
+
value="#{messages['ChangeLanguage']}"/></programlisting>
+ <para>When the user selects an item from the drop-down, then clicks
+ the command button, the Seam and JSF locales will be overridden for
+ the rest of the session.</para>
+ <para>The brings us to the question of where the supported locales
+ are defined. Typically, you provide a list of locales for which you
+ have matching resource bundles in the <literal>
+ <locale-config></literal> element of the JSF configuration file
+ (/META-INF/faces-config.xml). However, you have learned to appreciate
+ that Seam's component configuration mechanism is more powerful
+ than what is provided in Java EE. For that reason, you can configure
+ the supported locales, and the default locale of the server, using
+ the built-in component named <literal>
+ org.jboss.seam.international.localeConfig</literal>. To use it, you
+ first declare an XML namespace for Seam's international package
+ in the Seam component descriptor. You then define the default locale
+ and supported locales as follows:</para>
+ <programlisting role="XML"><international:locale-config
default-locale="fr_CA" supported-locales="en fr_CA
fr_FR"/></programlisting>
+ <para>Naturally, if you pronounce that you support a locale, you
+ better provide a resource bundle to match it! Up next, you'll
+ learn how to define the language-specific labels.</para>
+ </section>
+ <section id="labels">
+ <title>Labels</title>
+ <para>JSF supports internationalization of user interface labels and
+ descriptive text via the use of <literal><f:loadBundle
+ /></literal>. You can use this approach in Seam applications.
+ Alternatively, you can take advantage of the Seam <literal>
+ messages</literal> component to display templated labels with
+ embedded EL expressions.</para>
+ <section>
+ <title>Defining labels</title>
+ <para>Seam provides a <literal>java.util.ResourceBundle</literal>
+ (available to the application as a <literal>
+ org.jboss.seam.core.resourceBundle</literal>). You'll need to
+ make your internationalized labels available via this special
+ resource bundle. By default, the resource bundle used by Seam is
+ named <literal>messages</literal> and so you'll need to define
+ your labels in files named <literal>messages.properties</literal>,
+ <literal>messages_en.properties</literal>, <literal>
+ messages_en_AU.properties</literal>, etc. These files usually belong
+ in the <literal>WEB-INF/classes</literal> directory.</para>
+ <para>So, in
<literal>messages_en.properties</literal>:</para>
+ <programlisting>Hello=Hello</programlisting>
+ <para>And in
<literal>messages_en_AU.properties</literal>:</para>
+ <programlisting>Hello=G'day</programlisting>
+ <para>You can select a different name for the resource bundle by
+ setting the Seam configuration property named <literal>
+ org.jboss.seam.core.resourceLoader.bundleNames</literal>. You can
+ even specify a list of resource bundle names to be searched (depth
+ first) for messages.</para>
+ <programlisting role="XML"><core:resource-loader>
<core:bundle-names>
<value>mycompany_messages</value>
<value>standard_messages</value>
</core:bundle-names>
</core:resource-loader></programlisting>
-
- <para>If you want to define a message just for a particular page, you
- can specify it in a resource bundle with the same name as the JSF view
- id, with the leading <literal>/</literal> and trailing file extension
- removed. So we could put our message in <literal>
- welcome/hello_en.properties</literal> if we only needed to display the
- message on <literal> /welcome/hello.jsp</literal>.</para>
-
- <para>You can even specify an explicit bundle name in <literal>
- pages.xml</literal>:</para>
-
- <programlisting role="XML"><page
view-id="/welcome/hello.jsp"
bundle="HelloMessages"/></programlisting>
-
- <para>Then we could use messages defined in <literal>
- HelloMessages.properties</literal> on <literal>
- /welcome/hello.jsp</literal>.</para>
- </section>
-
- <section>
- <title>Displaying labels</title>
-
- <para>If you define your labels using the Seam resource bundle, you'll
- be able to use them without having to type <literal> <f:loadBundle
- ... /></literal> on every page. Instead, you can simply
type:</para>
-
- <programlisting role="XHTML"><h:outputText
value="#{messages['Hello']}"/></programlisting>
-
- <para>or:</para>
-
- <programlisting role="XHTML"><h:outputText
value="#{messages.Hello}"/></programlisting>
-
- <para>Even better, the messages themselves may contain EL
- expressions:</para>
-
- <programlisting>Hello=Hello, #{user.firstName}
#{user.lastName}</programlisting>
-
- <programlisting>Hello=G'day, #{user.firstName}</programlisting>
-
- <para>You can even use the messages in your code:</para>
-
- <programlisting role="JAVA">@In private Map<String,
String> messages;</programlisting>
-
- <programlisting
role="JAVA">@In("#{messages['Hello']}") private String
helloMessage;</programlisting>
- </section>
-
- <section>
- <title>Faces messages</title>
-
- <para>The <literal>facesMessages</literal> component is a
- super-convenient way to display success or failure messages to the user.
- The functionality we just described also works for faces
- messages:</para>
-
- <programlisting role="JAVA">@Name("hello")
+ <para>If you want to define a message just for a particular page,
+ you can specify it in a resource bundle with the same name as the
+ JSF view id, with the leading <literal>/</literal> and trailing file
+ extension removed. So we could put our message in <literal>
+ welcome/hello_en.properties</literal> if we only needed to display
+ the message on <literal>/welcome/hello.jsp</literal>.</para>
+ <para>You can even specify an explicit bundle name in <literal>
+ pages.xml</literal>:</para>
+ <programlisting role="XML"><page
view-id="/welcome/hello.jsp"
bundle="HelloMessages"/></programlisting>
+ <para>Then we could use messages defined in <literal>
+ HelloMessages.properties</literal> on <literal>
+ /welcome/hello.jsp</literal>.</para>
+ </section>
+ <section>
+ <title>Displaying labels</title>
+ <para>If you define your labels using the Seam resource bundle,
+ you'll be able to use them without having to type <literal>
+ <f:loadBundle ... /></literal> on every page. Instead, you can
+ simply type:</para>
+ <programlisting role="XHTML"><h:outputText
value="#{messages['Hello']}"/></programlisting>
+ <para>or:</para>
+ <programlisting role="XHTML"><h:outputText
value="#{messages.Hello}"/></programlisting>
+ <para>Even better, the messages themselves may contain EL
+ expressions:</para>
+ <programlisting>Hello=Hello, #{user.firstName}
#{user.lastName}</programlisting>
+ <programlisting>Hello=G'day, #{user.firstName}</programlisting>
+ <para>You can even use the messages in your code:</para>
+ <programlisting role="JAVA">@In private Map<String,
String> messages;</programlisting>
+ <programlisting
role="JAVA">@In("#{messages['Hello']}")
private String helloMessage;</programlisting>
+ </section>
+ <section>
+ <title>Faces messages</title>
+ <para>The <literal>facesMessages</literal> component is a
+ super-convenient way to display success or failure messages to the
+ user. The functionality we just described also works for faces
+ messages:</para>
+ <programlisting role="JAVA">@Name("hello")
@Stateless
public class HelloBean implements Hello {
@In FacesMessages facesMessages;
public String sayIt() {
- facesMessages.addFromResourceBundle("Hello");
+ facesMessages.addFromResourceBundle("Hello");
}
}</programlisting>
-
- <para>This will display <literal>Hello, Gavin King</literal> or
- <literal>G'day, Gavin</literal>, depending upon the user's
- locale.</para>
- </section>
- </section>
-
- <section>
- <title>Timezones</title>
-
- <para>There is also a session-scoped instance of <literal>
- java.util.Timezone</literal>, named <literal>
- org.jboss.seam.international.timezone</literal>, and a Seam component for
- changing the timezone named <literal>
- org.jboss.seam.international.timezoneSelector</literal>. By default, the
- timezone is the default timezone of the server. Unfortunately, the JSF
- specification says that all dates and times should be assumed to be UTC,
- and displayed as UTC, unless a timezone is explicitly specified using
- <literal> <f:convertDateTime></literal>. This is an
extremely
- inconvenient default behavior.</para>
-
- <note>
- <para>You can use application parameter to set up different default time
zone for JSF 2 in <filename>web.xml</filename>.
- <programlisting role="XML"><context-param>
+ <para>This will display <literal>Hello, Gavin King</literal> or
+ <literal>G'day, Gavin</literal>, depending upon the
user's
+ locale.</para>
+ </section>
+ </section>
+ <section>
+ <title>Timezones</title>
+ <para>There is also a session-scoped instance of <literal>
+ java.util.Timezone</literal>, named <literal>
+ org.jboss.seam.international.timezone</literal>, and a Seam component
+ for changing the timezone named <literal>
+ org.jboss.seam.international.timezoneSelector</literal>. By default,
+ the timezone is the default timezone of the server. Unfortunately,
+ the JSF specification says that all dates and times should be assumed
+ to be UTC, and displayed as UTC, unless a timezone is explicitly
+ specified using <literal><f:convertDateTime></literal>. This
is
+ an extremely inconvenient default behavior.</para>
+ <note>
+ <para>
+ You can use application parameter to set up different default time
+ zone for JSF 2 in
+ <filename>web.xml</filename>.
+ </para>
+ <programlisting role="XML"><context-param>
<param-name>javax.faces.DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE</param-name>
- <param-value>true</param-value>
- </context-param></programlisting>
- </para>
- </note>
-
- <para>Seam overrides this behavior, and defaults all dates and times to
- the Seam timezone. In addition, Seam provides the <literal>
- <s:convertDateTime></literal> tag which always performs
conversions
- in the Seam timezone.</para>
-
- <para>Seam also provides a default date converter to convert a string value
- to a date. This saves you from having to specify a converter on input fields
- that are simply capturing a date. The pattern is selected according the
- the user's locale and the time zone is selected as described above.</para>
- </section>
-
- <section>
- <title>Themes</title>
-
- <para>Seam applications are also very easily skinnable. The theme API is
- very similar to the localization API, but of course these two concerns are
- orthogonal, and some applications support both localization and
- themes.</para>
-
- <para>First, configure the set of supported themes:</para>
-
- <programlisting role="XML"><theme:theme-selector
cookie-enabled="true">
+ <param-value>true</param-value>
+</context-param></programlisting>
+ </note>
+ <para>Seam overrides this behavior, and defaults all dates and times
+ to the Seam timezone. In addition, Seam provides the <literal>
+ <s:convertDateTime></literal> tag which always performs
+ conversions in the Seam timezone.</para>
+ <para>Seam also provides a default date converter to convert a string
+ value to a date. This saves you from having to specify a converter on
+ input fields that are simply capturing a date. The pattern is
+ selected according the the user's locale and the time zone is
+ selected as described above.</para>
+ </section>
+ <section>
+ <title>Themes</title>
+ <para>Seam applications are also very easily skinnable. The theme API
+ is very similar to the localization API, but of course these two
+ concerns are orthogonal, and some applications support both
+ localization and themes.</para>
+ <para>First, configure the set of supported themes:</para>
+ <programlisting role="XML"><theme:theme-selector
cookie-enabled="true">
<theme:available-themes>
<value>default</value>
<value>accessible</value>
<value>printable</value>
</theme:available-themes>
</theme:theme-selector></programlisting>
-
- <para>Note that the first theme listed is the default theme.</para>
-
- <para>Themes are defined in a properties file with the same name as the
- theme. For example, the <literal>default</literal> theme is defined as a
- set of entries in <literal> default.properties</literal>. For example,
- <literal> default.properties</literal> might define:</para>
-
- <programlisting>css ../screen.css
+ <para>Note that the first theme listed is the default theme.</para>
+ <para>Themes are defined in a properties file with the same name as
+ the theme. For example, the <literal>default</literal> theme is
+ defined as a set of entries in <literal>default.properties</literal>.
+ For example, <literal>default.properties</literal> might
+ define:</para>
+ <programlisting>css ../screen.css
template /template.xhtml</programlisting>
- <para>Usually the entries in a theme resource bundle will be paths to CSS
- styles or images and names of facelets templates (unlike localization
- resource bundles which are usually text).</para>
-
- <para>Now we can use these entries in our JSP or facelets pages. For
- example, to theme the stylesheet in a facelets page:</para>
-
- <programlisting role="XHTML"><link
href="#{theme.css}" rel="stylesheet" type="text/css"
/></programlisting>
-
- <para>Or, when the page definition resides in a subdirectory:</para>
-
- <programlisting role="XHTML"><link
href="#{facesContext.externalContext.requestContextPath}#{theme.css}"
- rel="stylesheet" type="text/css"
/></programlisting>
-
- <para>Most powerfully, facelets lets us theme the template used by a
- <literal><ui:composition></literal>:</para>
-
- <programlisting role="XHTML"><ui:composition
xmlns="http://www.w3.org/1999/xhtml"
-
xmlns:ui="http://java.sun.com/jsf/facelets"
-
xmlns:h="http://java.sun.com/jsf/html"
-
xmlns:f="http://java.sun.com/jsf/core"
- template="#{theme.template}"></programlisting>
-
- <para>Just like the locale selector, there is a built-in theme selector to
- allow the user to freely switch themes:</para>
-
- <programlisting role="XHTML"><h:selectOneMenu
value="#{themeSelector.theme}">
- <f:selectItems value="#{themeSelector.themes}"/>
+ <para>Usually the entries in a theme resource bundle will be paths to
+ CSS styles or images and names of facelets templates (unlike
+ localization resource bundles which are usually text).</para>
+ <para>Now we can use these entries in our JSP or facelets pages. For
+ example, to theme the stylesheet in a facelets page:</para>
+ <programlisting role="XHTML"><link
href="#{theme.css}" rel="stylesheet"
type="text/css" /></programlisting>
+ <para>Or, when the page definition resides in a subdirectory:</para>
+ <programlisting role="XHTML"><link
href="#{facesContext.externalContext.requestContextPath}#{theme.css}"
+ rel="stylesheet" type="text/css"
/></programlisting>
+ <para>Most powerfully, facelets lets us theme the template used by a
+ <literal><ui:composition></literal>:</para>
+ <programlisting role="XHTML"><ui:composition
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+ template="#{theme.template}"></programlisting>
+ <para>Just like the locale selector, there is a built-in theme
+ selector to allow the user to freely switch themes:</para>
+ <programlisting role="XHTML"><h:selectOneMenu
value="#{themeSelector.theme}">
+ <f:selectItems value="#{themeSelector.themes}"/>
</h:selectOneMenu>
-<h:commandButton action="#{themeSelector.select}" value="Select
Theme"/></programlisting>
- </section>
-
- <section>
- <title>Persisting locale and theme preferences via cookies</title>
-
- <para>The locale selector, theme selector and timezone selector all
- support persistence of locale and theme preference to a cookie. Simply set
- the <literal>cookie-enabled</literal> property in
- <literal>components.xml</literal>:</para>
-
- <programlisting role="XML"><theme:theme-selector
cookie-enabled="true">
+<h:commandButton action="#{themeSelector.select}"
value="Select Theme"/></programlisting>
+ </section>
+ <section>
+ <title>Persisting locale and theme preferences via cookies</title>
+ <para>The locale selector, theme selector and timezone selector all
+ support persistence of locale and theme preference to a cookie.
+ Simply set the <literal>cookie-enabled</literal> property in
<literal>
+ components.xml</literal>:</para>
+ <programlisting role="XML"><theme:theme-selector
cookie-enabled="true">
<theme:available-themes>
<value>default</value>
<value>accessible</value>
@@ -432,6 +339,6 @@
</theme:available-themes>
</theme:theme-selector>
-<international:locale-selector
cookie-enabled="true"/></programlisting>
- </section>
+<international:locale-selector
cookie-enabled="true"/></programlisting>
+ </section>
</chapter>
Modified: branches/community/Seam_2_3/seam-reference-guide/src/docbook/en-US/Mail.xml
===================================================================
--- branches/community/Seam_2_3/seam-reference-guide/src/docbook/en-US/Mail.xml 2012-07-17
15:36:16 UTC (rev 14981)
+++ branches/community/Seam_2_3/seam-reference-guide/src/docbook/en-US/Mail.xml 2012-07-17
15:36:31 UTC (rev 14982)
@@ -399,8 +399,8 @@
<note>
<para>
The Seam Mail module requires the use of Facelets as the view
- technology. Future versions of the library may also support the use of
- JSP. Additionally, it requires the use of the seam-ui package.
+ technology. This is the default View technology in JSF 2.
+ Additionally, it requires the use of the jboss-seam-ui module.
</para>
</note>
@@ -426,10 +426,10 @@
<title>JNDI lookup in JBoss AS</title>
<para>
- The JBossAS <literal>deploy/mail-service.xml</literal> configures a
+ The JBoss AS 7 Mail service is defined in
<filename>standalone/configuration/standalone.xml</filename> file. It
configures a
JavaMail session binding into JNDI. The default service
configuration will need altering for your network.
- <ulink
url="http://www.jboss.org/community/wiki/JavaMail">http://ww...
+ <ulink
url="http://www.mastertheboss.com/jboss-application-server/379-jboss...
article how to configure Mail system in JBoss AS 7</ulink>
describes the service in more detail.
</para>
@@ -437,13 +437,13 @@
xmlns:core="http://jboss.org/schema/seam/core"
xmlns:mail="http://jboss.org/schema/seam/mail">
- <mail:mail-session session-jndi-name="java:/Mail"/>
+ <mail:mail-session session-jndi-name="java:jboss/mail/Default"/>
</components>]]></programlisting>
<para>
Here we tell Seam to get the mail session bound to
- <literal>java:/Mail</literal> from JNDI.
+ <literal>java:jboss/mail/Default</literal> from JNDI.
</para>
</section>
@@ -469,30 +469,6 @@
</section>
</section>
- <section>
- <title>Meldware</title>
-
- <para>
- Seam's mail examples use Meldware (from <ulink
url="http://buni.org">buni.org</ulink>)
- as a mail server. Meldware is a groupware package that provides
- <literal>SMTP</literal>, <literal>POP3</literal>,
<literal>IMAP</literal>,
- webmail, a shared calendar and an graphical admin tool; it's written as a
- JEE application so can be deployed onto JBoss AS alongside your Seam
- application.
- </para>
-
- <caution>
- <para>
- The version of Meldware distributed with Seam (downloaded on demand)
- is specially tailored for development - mailboxes, users and
- aliases (email addresses) are created every time the application
- deploys. If you want to use Meldware in production you should install
- the latest release from <ulink
url="http://buni.org">buni.org</ulink>.
- </para>
- </caution>
-
- </section>
-
<section id="mail.tags">
<title>Tags</title>
Modified: branches/community/Seam_2_3/seam-reference-guide/src/docbook/en-US/Testing.xml
===================================================================
---
branches/community/Seam_2_3/seam-reference-guide/src/docbook/en-US/Testing.xml 2012-07-17
15:36:16 UTC (rev 14981)
+++
branches/community/Seam_2_3/seam-reference-guide/src/docbook/en-US/Testing.xml 2012-07-17
15:36:31 UTC (rev 14982)
@@ -92,8 +92,7 @@
<title>Integration testing Seam components</title>
<note>
- Using JBoss Embedded for integration testing is now deprecated. The
preferred
- way is to use Arquillian. See <xref linkend="testing.arquillian"
/>
+ Using JBoss Embedded for integration testing was removed. See <xref
linkend="testing.arquillian" />
</note>
<para>
@@ -108,8 +107,7 @@
<para>
The approach taken by Seam is to let you write tests that exercise your
components while running inside a pruned down container environment (Seam,
- together with the JBoss Embedded container; see
- <xref linkend="config.install.embedded" /> for configuration
details)
+ together with the JBoss AS container)
</para>
<programlisting role="JAVA"><![CDATA[public class RegisterTest extends
SeamTest
@@ -202,7 +200,7 @@
</para>
<para>
- Let's consider a JSP view for the component we unit tested above:
+ Let's consider a JSF view for the component we unit tested above:
</para>
<programlisting role="XHTML"><![CDATA[<html>
@@ -301,9 +299,10 @@
<para>
You'll find plenty of integration tests for the Seam example
applications
which demonstrate more complex cases. There are instructions for running
- these tests using Ant, or using the TestNG plugin for eclipse:
+ these tests using Maven, or using the JUnit plugin for eclipse:
</para>
+<!-- TODO capture new JUnit screenshot -->
<mediaobject>
<imageobject role="fo">
<imagedata fileref="images/plugin-testng.png"
align="center" scalefit="1"/>
@@ -324,171 +323,32 @@
</para>
<para>
- First, lets look at the dependencies you need at a minimum:
- </para>
+ For ant or own build tool which uses jars on local - you can use to get all
jars
+ by running <literal>ant -f get-arquillian-libs.xml
-Dtest.lib.dir=lib/test</literal>. This just copy all Arquillian
+ jars for managed JBoss AS 7.1.1 container and copy all jars into defined
directory <filename>lib/test</filename>
+ by using that <literal>test.lib.dir</literal> property.
+ </para>
- <table>
- <title></title>
- <tgroup cols="3">
- <thead>
- <row >
- <entry>
- Group Id
- </entry>
- <entry>
- Artifact Id
- </entry>
- <entry>
- Location in Seam
- </entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>
- <literal>org.jboss.seam.embedded</literal>
- </entry>
- <entry>
- <literal>hibernate-all</literal>
- </entry>
- <entry>
- <literal>lib/test/hibernate-all.jar</literal>
- </entry>
- </row>
- <row>
- <entry>
- <literal>org.jboss.seam.embedded</literal>
- </entry>
- <entry>
- <literal>jboss-embedded-all</literal>
- </entry>
- <entry>
- <literal>lib/test/jboss-embedded-all.jar</literal>
- </entry>
- </row>
- <row>
- <entry>
- <literal>org.jboss.seam.embedded</literal>
- </entry>
- <entry>
- <literal>thirdparty-all</literal>
- </entry>
- <entry>
- <literal>lib/test/thirdparty-all.jar</literal>
- </entry>
- </row>
- <row>
- <entry>
- <literal>org.jboss.seam.embedded</literal>
- </entry>
- <entry>
- <literal>jboss-embedded-api</literal>
- </entry>
- <entry>
- <literal>lib/jboss-embedded-api.jar</literal>
- </entry>
- </row>
- <row>
- <entry>
- <literal>org.jboss.seam</literal>
- </entry>
- <entry>
- <literal>jboss-seam</literal>
- </entry>
- <entry>
- <literal>lib/jboss-seam.jar</literal>
- </entry>
- </row>
- <row>
- <entry>
- <literal>org.jboss.el</literal>
- </entry>
- <entry>
- <literal>jboss-el</literal>
- </entry>
- <entry>
- <literal>lib/jboss-el.jar</literal>
- </entry>
- </row>
- <row>
- <entry>
- <literal>javax.faces</literal>
- </entry>
- <entry>
- <literal>jsf-api</literal>
- </entry>
- <entry>
- <literal>lib/jsf-api.jar</literal>
- </entry>
- </row>
- <row>
- <entry>
- <literal>javax.el</literal>
- </entry>
- <entry>
- <literal>el-api</literal>
- </entry>
- <entry>
- <literal>lib/el-api.jar</literal>
- </entry>
- </row>
- <row>
- <entry>
- <literal>javax.activation</literal>
- </entry>
- <entry>
- <literal>javax.activation</literal>
- </entry>
- <entry>
- <literal>lib/activation.jar</literal>
- </entry>
- </row>
- </tbody>
- </tgroup>
- </table>
-
<para>
- It's very important you don't put the compile time JBoss AS
- dependencies from <literal>lib/</literal> (e.g.
- <literal>jboss-system.jar</literal>) on the classpath, these
- will cause Embedded JBoss to not boot. So, just add the
- dependencies (e.g. Drools, jBPM)you need as you go.
- </para>
-
- <para>
- You also need to include the <literal>bootstrap/</literal>
- directory on the classpath; <literal>bootstrap/</literal>
contains
- the configuration for Embedded JBoss.
- </para>
-
- <para>
And, of course you need to put your built project and tests onto
the classpath as well as jar for your test framework. Don't forget
to put all the correct configuration files for JPA and Seam onto
- the classpath as well.Seam asks Embedded JBoss to deploy any
+ the classpath as well.Seam asks Arquillian to deploy any
resource (jar or directory) which has
<literal>seam.properties</literal> in it's root. Therefore,
if you
don't assemble a directory structure that resembles a deployable
archive containing your built project, you must put a
<literal>seam.properties</literal> in each resource.
</para>
-
- <para>
- By default, a generated project will use the
- <literal>java:/DefaultDS</literal> (a built in HSQL datasource
in
- Embedded JBoss) for testing. If you want to use another datasource
- place the <literal>foo-ds.xml</literal> into
- <literal>bootstrap/deploy</literal> directory.
- </para>
-
+
</section>
<section>
<title>Using SeamTest with another test framework</title>
<para>
- Seam provides TestNG support out of the box, but you can also use
- another test framework, such as JUnit, if you want.
+ Seam provides JUnit and TestNG support out of the box, but you can also
use
+ another test framework, if you want.
</para>
<para>
@@ -552,7 +412,7 @@
<caution>
DBUnit supports two formats for dataset files, flat and XML. Seam's
- <literal>DBUnitSeamTest</literal> assumes the flat format is
used, so make sure that
+ <literal>DBUnitSeamTest</literal> or
<literal>DBJUnitSeamTest</literal> assumes the flat format is used, so make
sure that
your dataset is in this format.
</caution>
@@ -603,7 +463,7 @@
<programlisting role="XML"><![CDATA[<parameter
name="datasourceJndiName"
value="java:/seamdiscsDatasource"/>]]></programlisting>
<para>
- DBUnitSeamTest has support for MySQL and HSQL - you need to tell it
+ DBUnitSeamTest and DBJUnitSeamTest have support for MySQL and HSQL - you need
to tell it
which database is being used, otherwise it defaults to HSQL:
</para>
Modified: branches/community/Seam_2_3/seam-reference-guide/src/docbook/en-US/Tutorial.xml
===================================================================
---
branches/community/Seam_2_3/seam-reference-guide/src/docbook/en-US/Tutorial.xml 2012-07-17
15:36:16 UTC (rev 14981)
+++
branches/community/Seam_2_3/seam-reference-guide/src/docbook/en-US/Tutorial.xml 2012-07-17
15:36:31 UTC (rev 14982)
@@ -12,10 +12,32 @@
of the Seam distribution. The registration example, which will be the first
example we look at,
is in the <filename>examples/registration</filename>
directory.</para>
- <para>Each example has the same directory structure:</para>
+ <para>Each example has the very similar directory structure which is based
on Maven project structure defaults:</para>
<itemizedlist>
<listitem>
+ <para> The <filename>*-ear</filename> directory
contains enterprise application submodule files such as
+ aggregator for web application files, EJB project.
+ </para>
+ </listitem>
+ <listitem>
+ <para> The <filename>*-web</filename> directory
contains web application submodule view-related files such as
+ web page templates, images and stylesheets.
+ </para>
+ </listitem>
+ <listitem>
+ <para> The <filename>*-ejb</filename> directory
contains Enterprise Java Beans components.
+ </para>
+ </listitem>
+ <listitem>
+ <para> The <filename>*-tests</filename> directory
contains Maven integration and functional tests submodule.
+ </para>
+ </listitem>
+ </itemizedlist>
+
+ <!-- TODO rewrite to maven project structure -->
+ <itemizedlist>
+ <listitem>
<para> The <filename>view</filename> directory contains
view-related files such as
web page templates, images and stylesheets.
@@ -31,26 +53,26 @@
</listitem>
</itemizedlist>
+<!-- end of TODO rewrite to maven project structure -->
<para>
- The example applications run both on JBoss AS and Tomcat with no additional
configuration.
- The following sections will explain the procedure in both cases. Note that
all the examples
- are built and run from the Ant <filename>build.xml</filename>, so
you'll need a recent version
- of Ant installed before you get started.
+ The example applications run both on JBoss AS 7.1.1 with no additional
configuration.
+ The following sections will explain the procedure. Note that all the
examples
+ are built and run from the Maven <filename>pom.xml</filename>, so
you'll need at least version 3.x
+ of Maven installed before you get started. At the time of writing this text
recent version was 3.0.4.
</para>
-
<section>
<title>Running the examples on JBoss AS</title>
- <para>The examples are configured for use on JBoss AS 4.2 or 5.0.
You'll need to set <literal>jboss.home</literal>,
- in the shared <literal>build.properties</literal> file in the
root folder of your Seam
- installation, to the location of your JBoss AS
installation.</para>
+ <para>The examples are configured for use on JBoss AS 7.1. You'll
need to set <literal>JBOSS_HOME</literal>,
+ in your environment, to the location of your JBoss AS
installation.</para>
<para>Once you've set the location of JBoss AS and started the
application server, you can build and deploy
- any example by typing <literal>ant explode</literal> in the
directory for that example. Any example
- that is packaged as an EAR deploys to a URL like
+ any example by typing <literal>mvn install</literal> in the
example root directory. And deploys it by changing
+ to *-ear or *-web directory in case of existence only *-web submodule.
Type in that submodule <literal>mvn jboss-as:deploy</literal>.
+ Any example that is packaged as an EAR deploys to a URL like
<literal>/seam-<replaceable>example</replaceable></literal>, where
<replaceable>example</replaceable> is
the name of the example folder, with one exception. If the example folder
begins with seam, the prefix
"seam" is ommitted. For instance, if JBoss AS is running on
port 8080, the URL for the registration
@@ -60,48 +82,18 @@
<literal>http://localhost:8080/seam-space/</literal></ulink>.</para>
<para>If, on the other hand, the example gets packaged as a WAR, then
it deploys to a URL like
-
<literal>/jboss-seam-<replaceable>example</replaceable></literal>.
Most of the examples can be deployed as a WAR
- to Tomcat with Embedded JBoss by typing <literal>ant
tomcat.deploy</literal>. Several of the examples
+
<literal>/jboss-seam-<replaceable>example</replaceable></literal>.
Several of the examples
can only be deployed as a WAR. Those examples are groovybooking,
hibernate, jpa, and spring.
</para>
</section>
<section>
- <title>Running the examples on Tomcat</title>
-
- <para>The examples are also configured for use on Tomcat 6.0. You will
need to follow the
- instructions in <xref
linkend="config.install.embedded"/>
- for installing JBoss Embedded on Tomcat 6.0. JBoss Embedded is only
required to run the Seam
- demos that use EJB3 components on Tomcat. There are also examples of
non-EJB3 applications that
- can be run on Tomcat without the use of JBoss Embedded.
- </para>
- <para>You'll need to
- set <literal>tomcat.home</literal>, in the shared
<literal>build.properties</literal> file in
- the root folder of your Seam installation, to the location of your Tomcat
installation.
- make sure you set the location of your Tomcat.
- </para>
-
- <para>You'll need to use a different Ant target when using Tomcat.
Use
- <literal>ant tomcat.deploy</literal> in example subdirectory
to build and deploy
- any example for Tomcat.
- </para>
-
- <para>On Tomcat, the examples deploy to URLs like
-
<literal>/jboss-seam-<replaceable>example</replaceable></literal>,
so for the registration
- example the URL would be <ulink
url="http://localhost:8080/jboss-seam-registration/">
-
<literal>http://localhost:8080/jboss-seam-registration/</literal></ulink>.
The same is true
- for examples that deploy as a WAR, as mentioned in the previous section.
- </para>
-
- </section>
-
- <section>
<title>Running the example tests</title>
<para>
- Most of the examples come with a suite of TestNG integration tests. The
easiest way to run the tests is
- to run <literal>ant test</literal>. It is also possible to
run the tests inside your IDE using the
- TestNG plugin. Consult the readme.txt in the examples directory of the
Seam distribution for more
+ Most of the examples come with a suite of Arquillian JUnit integration
tests. The easiest way to run the tests is
+ to run <literal>mvn verify
-Darquillian=jbossas-managed-7</literal>. It is also possible to run the tests
inside your IDE using the
+ JUnit plugin. Consult the readme.txt in the examples directory of the
Seam distribution for more
information.
</para>
</section>
@@ -178,7 +170,7 @@
public User() {}
- @NotNull @Length(min=5, max=15)
+ @NotNull @Size(min=5, max=15)
public String getPassword()
{
return password;
@@ -200,7 +192,7 @@
this.name = name;
}
- @Id @NotNull @Length(min=5, max=15)
+ @Id @NotNull @Size(min=5, max=15)
public String getUsername()
{
return username;
@@ -253,7 +245,7 @@
</para>
</callout>
<callout arearefs="registration-notnull">
- <para> The <literal>@NotNull</literal>
and <literal>@Length</literal> annotations are
+ <para> The <literal>@NotNull</literal>
and <literal>@Size</literal> annotations are
part of the Hibernate Validator framework. Seam
integrates Hibernate Validator and
lets you use it for data validation (even if you are
not using Hibernate for
persistence). </para>
@@ -269,7 +261,7 @@
<literal>@Scope</literal> annotations. These
annotations establish that this class is a Seam component. </para>
<para> We'll see below that the properties of our
<literal>User</literal> class are bound
directly to JSF components and are populated by JSF during the
update model values phase. We
- don't need any tedious glue code to copy data back and forth
between the JSP pages and the
+ don't need any tedious glue code to copy data back and forth
between the JSF pages and the
entity bean domain model. </para>
<para> However, entity beans shouldn't do transaction
management or database access. So we can't use
this component as a JSF action listener. For that we need a
session bean. </para>
@@ -436,7 +428,7 @@
<title>The view: <literal>register.xhtml</literal> and
<literal>registered.xhtml</literal></title>
<para> The view pages for a Seam application could be implemented
using any technology that supports
- JSF. In this example we use Facelets, because we think it's
better than JSP.</para>
+ JSF. In this example we use Facelets, because we think it's
better than JSF.</para>
<example>
<title>register.xhtml</title>
@@ -540,9 +532,14 @@
<para> This code configures a property named
<literal>jndiPattern</literal> of a built-in Seam component
named <literal>org.jboss.seam.core.init</literal>. The
funny <literal>@</literal> symbols are
- there because our Ant build script puts the correct JNDI pattern in
when we deploy the application,
+ there because our Maven build puts the correct JNDI pattern in when
we deploy the application,
which it reads from the components.properties file. You learn more
about how this process works in
<xref linkend="xml.descriptor"/>.</para>
+
+ <note>
+ <para>Eclipse M2e Web tools plugin can't use the
<literal>@</literal> for token property filtering. Fortunately
+ there works the other way which is in Maven filtering defined -
<literal>${property}</literal>.</para>
+ </note>
</section>
@@ -558,8 +555,8 @@
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">
+
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
+ version="3.0">
<listener>
<listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
@@ -607,21 +604,16 @@
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_1_2.xsd"
- version="1.2">
-
- <application>
- <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
- </application>
+
http://java.sun.com/xml/ns/javaee/web-facesconfig_2_1.xsd"
+ version="2.1">
</faces-config>]]></programlisting>
</example>
<para> Note that we don't need
- any JSF managed bean declarations! Our managed beans are annotated
Seam components. In Seam applications,
- the <literal>faces-config.xml</literal> is used much less
often than in plain JSF. Here, we are simply
- using it to enable Facelets as the view handler instead of
JSP.</para>
+ any JSF managed bean declarations and neither FaceletViewHandler
definition as Facelets are default view technology
+ in JSF 2! Our managed beans are annotated Seam
components.</para>
<para> In fact, once you have all the basic descriptors set up, the
<emphasis>only</emphasis> XML you
need to write as you add new functionality to a Seam application is
orchestration: navigation rules
@@ -681,7 +673,7 @@
<persistence-unit name="userDatabase">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
- <jta-data-source>java:/DefaultDS</jta-data-source>
+ <jta-data-source>java:jboss/datasources/ExampleDS</jta-data-source>
<properties>
<property name="hibernate.hbm2ddl.auto"
value="create-drop"/>
</properties>
@@ -695,34 +687,34 @@
<title>The EAR deployment descriptor:
<literal>application.xml</literal></title>
<para> Finally, since our application is deployed as an EAR, we
need a deployment descriptor there, too. </para>
+
+ <note>
+ <para>This file can be generated by Maven EAR plugin and
registration application has got this set up registration-ear/pom.xml.</para>
+ </note>
+ <para>Just for imagination, the following is the result of that
generation:</para>
+
<example
id="registration-application-xml"><title>registration
application</title>
<programlisting role="XML"><![CDATA[<?xml
version="1.0" encoding="UTF-8"?>
<application
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/application_5.xsd"
- version="5">
-
- <display-name>Seam Registration</display-name>
-
+
http://java.sun.com/xml/ns/javaee/application_6.xsd"
+ version="6">
+ <display-name>registration-ear</display-name>
<module>
<web>
- <web-uri>jboss-seam-registration.war</web-uri>
+ <web-uri>registration-web.war</web-uri>
<context-root>/seam-registration</context-root>
</web>
</module>
<module>
- <ejb>jboss-seam-registration.jar</ejb>
+ <ejb>registration-ejb.jar</ejb>
</module>
<module>
<ejb>jboss-seam.jar</ejb>
</module>
- <module>
- <java>jboss-el.jar</java>
- </module>
-
</application>]]></programlisting>
</example>
@@ -784,7 +776,7 @@
<section>
<title>Understanding the code</title>
<para> The message list example has one entity bean,
<literal>Message</literal>, one session bean,
- <literal>MessageListBean</literal> and one JSP.
</para>
+ <literal>MessageListBean</literal> and one JSF.
</para>
<section>
<title>The entity bean:
<literal>Message.java</literal></title>
@@ -815,7 +807,7 @@
this.id = id;
}
- @NotNull @Length(max=100)
+ @NotNull @Size(max=100)
public String getTitle()
{
return title;
@@ -956,7 +948,7 @@
needing to make any explicit call to the
<literal>EntityManager</literal>. </para>
</callout>
<callout arearefs="messages-factory">
- <para> The first time we navigate to the JSP page,
there will be no value in the
+ <para> The first time we navigate to the JSF page,
there will be no value in the
<literal>messageList</literal>
context variable. The <literal>@Factory</literal>
annotation tells Seam to create an instance of
<literal>MessageManagerBean</literal>
and invoke the
<literal>findMessages()</literal> method to initialize the value. We
@@ -1008,58 +1000,58 @@
<para> Let's skip over
<literal>components.xml</literal>,
<literal>persistence.xml</literal>,
<literal>web.xml</literal>,
<literal>ejb-jar.xml</literal>,
<literal>faces-config.xml</literal>
and <literal>application.xml</literal> since they are
much the same as the previous example, and go
- straight to the JSP. </para>
+ straight to the JSF. </para>
</section>
<section>
- <title>The view:
<literal>messages.jsp</literal></title>
+ <title>The view:
<literal>messages.xhtml</literal></title>
- <para> The JSP page is a straightforward use of the JSF
<literal><h:dataTable></literal>
+ <para> The JSF page is a straightforward use of the JSF
<literal><h:dataTable></literal>
component. Again, nothing specific to Seam. </para>
<example>
- <title>messages.jsp</title>
- <programlisting role="XHTML"><![CDATA[<%@
taglib
uri="http://java.sun.com/jsf/html" prefix="h" %>
-<%@ taglib
uri="http://java.sun.com/jsf/core" prefix="f" %>
-<html>
+ <title>messages.xhtml</title>
+ <programlisting role="XHTML"><![CDATA[<?xml
version="1.0" encoding="utf-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:s="http://jboss.org/schema/seam/taglib"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core">
<head>
<title>Messages</title>
</head>
<body>
<f:view>
- <h:form>
<h2>Message List</h2>
- <h:outputText value="No messages to display"
- rendered="#{messageList.rowCount==0}"/>
- <h:dataTable var="msg" value="#{messageList}"
- rendered="#{messageList.rowCount>0}">
+ <h:outputText id="noMessages" value="No messages to display"
rendered="#{messageList.rowCount==0}"/>
+ <h:dataTable id="messages" var="msg"
value="#{messageList}" rendered="#{messageList.rowCount>0}">
<h:column>
<f:facet name="header">
<h:outputText value="Read"/>
</f:facet>
- <h:selectBooleanCheckbox value="#{msg.read}"
disabled="true"/>
+ <h:selectBooleanCheckbox id="read" value="#{msg.read}"
disabled="true"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Title"/>
</f:facet>
- <h:commandLink value="#{msg.title}"
action="#{messageManager.select}"/>
+ <s:link id="link" value="#{msg.title}"
action="#{messageManager.select}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Date/Time"/>
</f:facet>
- <h:outputText value="#{msg.datetime}">
+ <h:outputText id="date" value="#{msg.datetime}">
<f:convertDateTime type="both" dateStyle="medium"
timeStyle="short"/>
</h:outputText>
</h:column>
<h:column>
- <h:commandButton value="Delete"
action="#{messageManager.delete}"/>
+ <s:button id="delete" value="Delete"
action="#{messageManager.delete}"/>
</h:column>
</h:dataTable>
- <h3><h:outputText value="#{message.title}"/></h3>
- <div><h:outputText value="#{message.text}"/></div>
- </h:form>
+ <h3><h:outputText id="title"
value="#{message.title}"/></h3>
+ <div><h:outputText id="text"
value="#{message.text}"/></div>
</f:view>
</body>
</html>]]></programlisting>
@@ -1073,7 +1065,7 @@
<section>
<title>How it works</title>
- <para> The first time we navigate to the
<literal>messages.jsp</literal> page, the page will try to resolve the
+ <para> The first time we navigate to the
<literal>messages.xhtml</literal> page, the page will try to resolve the
<literal>messageList</literal> context variable. Since
this context variable is not initialized,
Seam will call the factory method
<literal>findMessages()</literal>, which performs a query against the
database and results in a <literal>DataModel</literal> being
outjected. This
@@ -1200,7 +1192,7 @@
trivial possible business process: there is one
<emphasis>task</emphasis> to be performed, and when that
task is complete, the business process ends. </para>
- <para> The first JavaBean handles the login screen
<literal>login.jsp</literal>. Its job is just to
+ <para> The first JavaBean handles the login screen
<literal>login.xhtml</literal>. Its job is just to
initialize the jBPM actor id using the
<literal>actor</literal> component. In a real application, it
would also need to authenticate the user.</para>
<example>
@@ -1226,7 +1218,7 @@
public String login()
{
actor.setId(user);
- return "/todo.jsp";
+ return "/todo.xhtml";
}
}]]></programlisting>
</example>
@@ -1235,27 +1227,31 @@
<para> Here we see the use of <literal>@In</literal> to
inject the built-in <literal>Actor</literal>
component. </para>
- <para> The JSP itself is trivial: </para>
+ <para> The JSF itself is trivial: </para>
<example>
- <title>login.jsp</title>
- <programlisting role="XHTML"><![CDATA[<%@ taglib
uri="http://java.sun.com/jsf/html" prefix="h"%>
-<%@ taglib
uri="http://java.sun.com/jsf/core" prefix="f"%>
-<html>
-<head>
-<title>Login</title>
-</head>
-<body>
-<h1>Login</h1>
-<f:view>
- <h:form>
- <div>
- <h:inputText value="#{login.user}"/>
- <h:commandButton value="Login"
action="#{login.login}"/>
- </div>
- </h:form>
-</f:view>
-</body>
+ <title>login.xhtml</title>
+ <programlisting role="XHTML"><![CDATA[<?xml
version="1.0" encoding="utf-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:s="http://jboss.org/schema/seam/taglib"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core">
+ <head>
+ <title>Login</title>
+ </head>
+ <body>
+ <h1>Login</h1>
+ <f:view>
+ <h:form id="login">
+ <div>
+ <h:inputText id="username"
value="#{login.user}"/>
+ <h:commandButton id="submit" value="Login"
action="#{login.login}"/>
+ </div>
+ </h:form>
+ </f:view>
+ </body>
</html>]]></programlisting></example>
@@ -1295,7 +1291,7 @@
}]]></programlisting>
<calloutlist>
<callout arearefs="todo-description">
- <para> The description property accepts user input from
the JSP page, and exposes it to the
+ <para> The description property accepts user input from
the JSF page, and exposes it to the
process definition, allowing the task description to be
set. </para>
</callout>
<callout
arearefs="todo-createprocess-annotation">
@@ -1316,9 +1312,9 @@
appear on the same method, because there is usually work to be done using
the application in order to
complete the task. </para>
- <para> Finally, the core of the application is in
<literal>todo.jsp</literal>: </para>
+ <para> Finally, the core of the application is in
<literal>todo.xhtml</literal>: </para>
<example>
- <title>todo.jsp</title>
+ <title>todo.xhtml</title>
<programlisting role="XHTML"><![CDATA[<%@ taglib
uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib
uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib
uri="http://jboss.org/schema/seam/taglib" prefix="s"
%>
@@ -1392,7 +1388,7 @@
<para> The page renders a list of tasks, which it gets from a built-in
Seam component named
<literal>taskInstanceList</literal>. The list is defined
inside a JSF form. </para>
<example>
- <title>todo.jsp</title>
+ <title>todo.xhtml</title>
<programlisting role="XHTML"><![CDATA[<h:form
id="list">
<div>
<h:outputText value="There are no todo items." rendered="#{empty
taskInstanceList}"/>
@@ -1470,7 +1466,7 @@
<section>
<title>How it works</title>
- <para>After logging in, todo.jsp uses the
<literal>taskInstanceList</literal> component to display a table
+ <para>After logging in, todo.xhtml uses the
<literal>taskInstanceList</literal> component to display a table
of outstanding todo items for a the current user. Initially there are none.
It
also presents a form to enter a new entry. When the user types the todo item
and
hits the "Create New Item" button,
<literal>#{todoList.createTodo}</literal> is called. This starts
@@ -1488,7 +1484,7 @@
</para>
<para>
- When <literal>todo.jsp</literal> is redisplayed,
<literal>taskInstanceList</literal> now finds
+ When <literal>todo.xhtml</literal> is redisplayed,
<literal>taskInstanceList</literal> now finds
the task that was just created.
The task is shown in an <literal>h:dataTable</literal>. The
internal state of the task is
displayed in
@@ -1508,7 +1504,7 @@
The state of the task and process are both updated in the database.
</para>
- <para>When <literal>todo.jsp</literal> is displayed again,
the now-completed task is no longer
+ <para>When <literal>todo.xhtml</literal> is displayed
again, the now-completed task is no longer
displayed in the
<literal>taskInstanceList</literal>, since that component only
display active tasks for the user.</para>
</section>
@@ -1538,7 +1534,7 @@
<section>
<title>Understanding the code</title>
- <para> The example is implemented using one JavaBean, three JSP pages
and a jPDL pageflow definition. Let's
+ <para> The example is implemented using one JavaBean, three JSF pages
and a jPDL pageflow definition. Let's
begin with the pageflow: </para>
<!-- Can't use code hightlighting with callouts -->
<example>
@@ -1557,7 +1553,7 @@
http://jboss.org/schema/seam/pageflow-2.3.xsd"
name="numberGuess">
- <start-page name="displayGuess"
view-id="/numberGuess.jspx">
+ <start-page name="displayGuess"
view-id="/numberGuess.xhtml">
<redirect/>
<transition name="guess" to="evaluateGuess">
<action expression="#{numberGuess.guess}"/>
@@ -1576,7 +1572,7 @@
<transition name="false" to="displayGuess"/>
</decision>
- <page name="giveup" view-id="/giveup.jspx">
+ <page name="giveup" view-id="/giveup.xhtml">
<redirect/>
<transition name="yes" to="lose"/>
<transition name="no" to="displayGuess"/>
@@ -1587,12 +1583,12 @@
<transition to="displayGuess"/>
</process-state>
- <page name="win" view-id="/win.jspx">
+ <page name="win" view-id="/win.xhtml">
<redirect/>
<end-conversation/>
</page>
- <page name="lose" view-id="/lose.jspx">
+ <page name="lose" view-id="/lose.xhtml">
<redirect/>
<end-conversation/>
</page>
@@ -1639,120 +1635,98 @@
<para> Now that we have seen the pageflow, it is very, very easy to
understand the rest of the application! </para>
- <para> Here is the main page of the application,
<literal>numberGuess.jspx</literal>: </para>
+ <para> Here is the main page of the application,
<literal>numberGuess.xhtml</literal>: </para>
<example>
- <title>numberGuess.jspx</title>
- <programlisting role="XHTML"><![CDATA[<<?xml
version="1.0"?>
-<jsp:root
xmlns:jsp="http://java.sun.com/JSP/Page"
-
xmlns:h="http://java.sun.com/jsf/html"
-
xmlns:f="http://java.sun.com/jsf/core"
-
xmlns:s="http://jboss.org/schema/seam/taglib"
-
xmlns="http://www.w3.org/1999/xhtml"
- version="2.0">
- <jsp:output doctype-root-element="html"
- doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
-
doctype-system="http://www.w3c.org/TR/xhtml1/DTD/xhtml1-transitional...
- <jsp:directive.page contentType="text/html"/>
- <html>
+ <title>numberGuess.xhtml</title>
+ <programlisting role="XHTML"><![CDATA[<!DOCTYPE
html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:s="http://jboss.org/schema/seam/taglib">
<head>
<title>Guess a number...</title>
<link href="niceforms.css" rel="stylesheet"
type="text/css" />
- <script language="javascript" type="text/javascript"
src="niceforms.js" />
+ <script language="javascript" type="text/javascript"
src="niceforms.js"><!-- --></script>
</head>
<body>
<h1>Guess a number...</h1>
- <f:view>
- <h:form styleClass="niceform">
-
+ <h:form id="NumberGuessMain" styleClass="niceform">
+
<div>
- <h:messages globalOnly="true"/>
- <h:outputText value="Higher!"
- rendered="#{numberGuess.randomNumber gt
numberGuess.currentGuess}"/>
- <h:outputText value="Lower!"
- rendered="#{numberGuess.randomNumber lt
numberGuess.currentGuess}"/>
+ <h:messages id="messages" globalOnly="true"/>
+ <h:outputText id="Higher"
+ value="Higher!"
+ rendered="#{numberGuess.randomNumber gt
numberGuess.currentGuess}"/>
+ <h:outputText id="Lower"
+ value="Lower!"
+ rendered="#{numberGuess.randomNumber lt
numberGuess.currentGuess}"/>
</div>
-
+
<div>
- I'm thinking of a number between
- <h:outputText value="#{numberGuess.smallest}"/> and
- <h:outputText value="#{numberGuess.biggest}"/>. You have
- <h:outputText value="#{numberGuess.remainingGuesses}"/> guesses.
+ I'm thinking of a number between <h:outputText id="Smallest"
value="#{numberGuess.smallest}"/> and
+ <h:outputText id="Biggest"
value="#{numberGuess.biggest}"/>. You have
+ <h:outputText id="RemainingGuesses"
value="#{numberGuess.remainingGuesses}"/> guesses.
</div>
-
+
<div>
- Your guess:
- <h:inputText value="#{numberGuess.currentGuess}"
id="inputGuess"
- required="true" size="3"
- rendered="#{(numberGuess.biggest-numberGuess.smallest) gt
20}">
+ Your guess:
+ <h:inputText id="inputGuess"
value="#{numberGuess.currentGuess}" required="true" size="3"
+ rendered="#{(numberGuess.biggest-numberGuess.smallest) gt
20}">
<f:validateLongRange maximum="#{numberGuess.biggest}"
minimum="#{numberGuess.smallest}"/>
</h:inputText>
- <h:selectOneMenu value="#{numberGuess.currentGuess}"
- id="selectGuessMenu" required="true"
- rendered="#{(numberGuess.biggest-numberGuess.smallest) le
20 and
- (numberGuess.biggest-numberGuess.smallest) gt
4}">
- <s:selectItems value="#{numberGuess.possibilities}"
var="i" label="#{i}"/>
+ <h:selectOneMenu id="selectGuessMenu"
value="#{numberGuess.currentGuess}" required="true"
+ rendered="#{(numberGuess.biggest-numberGuess.smallest) le 20
and (numberGuess.biggest-numberGuess.smallest) gt 4}">
+ <s:selectItems id="PossibilitiesMenuItems"
value="#{numberGuess.possibilities}" var="i"
label="#{i}"/>
</h:selectOneMenu>
- <h:selectOneRadio value="#{numberGuess.currentGuess}"
id="selectGuessRadio"
- required="true"
- rendered="#{(numberGuess.biggest-numberGuess.smallest) le
4}">
- <s:selectItems value="#{numberGuess.possibilities}"
var="i" label="#{i}"/>
+ <h:selectOneRadio id="selectGuessRadio"
value="#{numberGuess.currentGuess}" required="true"
+ rendered="#{(numberGuess.biggest-numberGuess.smallest) le
4}">
+ <s:selectItems id="PossibilitiesRadioItems"
value="#{numberGuess.possibilities}" var="i"
label="#{i}"/>
</h:selectOneRadio>
- <h:commandButton value="Guess" action="guess"/>
- <s:button value="Cheat" view="/confirm.jspx"/>
- <s:button value="Give up" action="giveup"/>
+ <h:commandButton id="GuessButton" value="Guess"
action="guess"/>
+ <s:button id="CheatButton" value="Cheat"
action="cheat"/>
+ <s:button id="GiveUpButton" value="Give up"
action="giveup"/>
</div>
-
+
<div>
- <h:message for="inputGuess" style="color: red"/>
+ <h:message id="message" for="inputGuess"
style="color: red"/>
</div>
-
+
</h:form>
- </f:view>
</body>
- </html>
-</jsp:root>]]></programlisting>
+</html>]]></programlisting>
</example>
<para> Notice how the command button names the
<literal>guess</literal> transition instead of calling an
action directly. </para>
- <para> The <literal>win.jspx</literal> page is predictable:
</para>
+ <para> The <literal>win.xhtml</literal> page is
predictable: </para>
<example>
- <title>win.jspx</title>
- <programlisting role="JSP"><![CDATA[<jsp:root
xmlns:jsp="http://java.sun.com/JSP/Page"
-
xmlns:h="http://java.sun.com/jsf/html"
-
xmlns:f="http://java.sun.com/jsf/core"
-
xmlns="http://www.w3.org/1999/xhtml"
- version="2.0">
- <jsp:output doctype-root-element="html"
- doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
-
doctype-system="http://www.w3c.org/TR/xhtml1/DTD/xhtml1-transitional...
- <jsp:directive.page contentType="text/html"/>
- <html>
+ <title>win.xhtml</title>
+ <programlisting role="JSF"><![CDATA[<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:s="http://jboss.org/schema/seam/taglib">
<head>
<title>You won!</title>
<link href="niceforms.css" rel="stylesheet"
type="text/css" />
</head>
<body>
<h1>You won!</h1>
- <f:view>
- Yes, the answer was <h:outputText value="#{numberGuess.currentGuess}"
/>.
- It took you <h:outputText value="#{numberGuess.guessCount}" />
guesses.
- <h:outputText value="But you cheated, so it doesn't count!"
- rendered="#{numberGuess.cheat}"/>
+ Yes, the answer was <h:outputText id="CurrentGuess"
value="#{numberGuess.currentGuess}" />.
+ It took you <h:outputText id="GuessCount"
value="#{numberGuess.guessCount}" /> guesses.
+ <h:outputText id="CheatedMessage" value="But you cheated, so it
doesn't count!" rendered="#{numberGuess.cheat}"/>
Would you like to <a href="numberGuess.seam">play again</a>?
- </f:view>
</body>
- </html>
-</jsp:root>
+</html>
]]></programlisting>
</example>
- <para>The <literal>lose.jspx</literal> looks roughly the
same, so we'll skip over it.</para>
+ <para>The <literal>lose.xhtml</literal> looks roughly the
same, so we'll skip over it.</para>
<para>Finally, we'll look at the actual application code:
</para>
<!-- Can't use code hightlighting with callouts -->
@@ -1867,7 +1841,7 @@
]]></programlisting>
<calloutlist>
<callout arearefs="numberguess-create">
- <para> The first time a JSP page asks for a
<literal>numberGuess</literal> component, Seam
+ <para> The first time a JSF page asks for a
<literal>numberGuess</literal> component, Seam
will create a new one for it, and the
<literal>@Create</literal> method will be invoked,
allowing the component to initialize itself.
</para>
</callout>
@@ -1891,7 +1865,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://jboss.org/schema/seam/pages
http://jboss.org/schema/seam/pages-2.3.xsd">
- <page view-id="/numberGuess.jspx">
+ <page view-id="/numberGuess.xhtml">
<begin-conversation join="true" pageflow="numberGuess"/>
</page>
@@ -1908,7 +1882,7 @@
<section>
<title>How it works</title>
<para>We'll step through basic flow of the application. The game
starts with the
- <literal>numberGuess.jspx</literal> view. When the page is
first displayed, the
+ <literal>numberGuess.xhtml</literal> view. When the page is
first displayed, the
<literal>pages.xml</literal> configuration causes
conversation to begin and associates
the <literal>numberGuess</literal> pageflow
with that conversation. The pageflow starts with a
<literal>start-page</literal> tag,
@@ -1934,7 +1908,7 @@
tests the <literal>#{numberGuess.lastGuess}</literal> state
to determine whether or not the user has
more guesses. If there are more guesses
(<literal>lastGuess</literal> is <literal>false</literal>),
we transition back to the original
<literal>displayGuess</literal> state. Finally we've
- reached a page state, so the associated page
<literal>/numberGuess.jspx</literal> is displayed.
+ reached a page state, so the associated page
<literal>/numberGuess.xhtml</literal> is displayed.
Since the page has a redirect element, Seam sends a redirect to the
user's browser,
starting the process over.
</para>
@@ -1942,7 +1916,7 @@
<para>
We won't follow the state any more except to note that if on a future
request either the
<literal>win</literal> or the
<literal>lose</literal> transition were taken, the user would
- be taken to either the <literal>/win.jspx</literal> or
<literal>/lose.jspx</literal>.
+ be taken to either the <literal>/win.xhtml</literal> or
<literal>/lose.xhtml</literal>.
Both states specify that Seam should end the conversation, tossing away
all the game state and
pageflow state, before redirecting the user to the
final page.
@@ -2011,8 +1985,8 @@
</mediaobject>
</screenshot>
- <para> The booking application uses JSF, EJB 3.0 and Seam, together
with Facelets for the view. There is
- also a port of this application to JSF, Facelets, Seam, JavaBeans and
Hibernate3. </para>
+ <para> The booking application uses JSF 2, EJB 3.0 and Seam, together
with Facelets for the view. There is
+ also a port of this application to JSF 2, Seam, JavaBeans and Hibernate4.
</para>
<para> One of the things you'll notice if you play with this
application for long enough is that it is
extremely <emphasis>robust</emphasis>. You can play with back
buttons and browser refresh and opening
@@ -2272,36 +2246,34 @@
<area id="booking-outputpanel-element"
coords="37"/>
<area id="booking-link-element"
coords="61"/>
</areaspec>
- <programlisting><![CDATA[<div class="section">
+ <programlisting><![CDATA[
+<div class="section">
<span class="errors">
- <h:messages globalOnly="true"/>
+ <h:messages id="messages" globalOnly="true"/>
</span>
<h1>Search Hotels</h1>
<h:form id="searchCriteria">
- <fieldset>
- <h:inputText id="searchString"
value="#{hotelSearch.searchString}"
- style="width: 165px;">
- <a:support event="onkeyup"
actionListener="#{hotelSearch.find}"
- reRender="searchResults" />
- </h:inputText>
+ <fieldset>
+ <h:inputText id="searchString"
value="#{hotelSearch.searchString}" style="width: 165px;">
+ <a:ajax event="keyup" render="searchResults"
listener="#{hotelSearch.find}"/>
+ </h:inputText>
 
- <a:commandButton id="findHotels" value="Find Hotels"
action="#{hotelSearch.find}"
- reRender="searchResults"/>
+ <a:commandButton id="findHotels" value="Find Hotels"
actionListener="#{hotelSearch.find}" render="searchResults"/>
 
- <a:status>
- <f:facet name="start">
- <h:graphicImage value="/img/spinner.gif"/>
+ <a:status id="status">
+ <f:facet id="StartStatus" name="start">
+ <h:graphicImage id="SpinnerGif"
value="/img/spinner.gif"/>
</f:facet>
</a:status>
<br/>
- <h:outputLabel for="pageSize">Maximum
results:</h:outputLabel> 
- <h:selectOneMenu value="#{hotelSearch.pageSize}"
id="pageSize">
- <f:selectItem itemLabel="5" itemValue="5"/>
- <f:selectItem itemLabel="10" itemValue="10"/>
- <f:selectItem itemLabel="20" itemValue="20"/>
+ <h:outputLabel id="MaximumResultsLabel"
for="pageSize">Maximum results:</h:outputLabel> 
+ <h:selectOneMenu id="pageSize"
value="#{hotelSearch.pageSize}">
+ <f:selectItem id="PageSize5" itemLabel="5"
itemValue="5"/>
+ <f:selectItem id="PageSize10" itemLabel="10"
itemValue="10"/>
+ <f:selectItem id="PageSize20" itemLabel="20"
itemValue="20"/>
</h:selectOneMenu>
</fieldset>
</h:form>
@@ -2310,39 +2282,36 @@
<a:outputPanel id="searchResults">
<div class="section">
- <h:outputText value="No Hotels Found"
- rendered="#{hotels != null and hotels.rowCount==0}"/>
- <h:dataTable id="hotels" value="#{hotels}" var="hot"
- rendered="#{hotels.rowCount>0}">
- <h:column>
- <f:facet name="header">Name</f:facet>
+ <h:outputText id="NoHotelsFoundMessage" value="No Hotels
Found" rendered="#{hotels != null and hotels.rowCount==0}"/>
+ <h:dataTable id="hotels" value="#{hotels}" var="hot"
rendered="#{hotels.rowCount>0}">
+ <h:column id="column1">
+ <f:facet id="NameFacet"
name="header">Name</f:facet>
#{hot.name}
</h:column>
- <h:column>
- <f:facet name="header">Address</f:facet>
+ <h:column id="column2">
+ <f:facet id="AddressFacet"
name="header">Address</f:facet>
#{hot.address}
</h:column>
- <h:column>
- <f:facet name="header">City, State</f:facet>
+ <h:column id="column3">
+ <f:facet id="CityStateFacet" name="header">City,
State</f:facet>
#{hot.city}, #{hot.state}, #{hot.country}
</h:column>
- <h:column>
- <f:facet name="header">Zip</f:facet>
+ <h:column id="column4">
+ <f:facet id="ZipFacet"
name="header">Zip</f:facet>
#{hot.zip}
</h:column>
- <h:column>
- <f:facet name="header">Action</f:facet>
- <s:link id="viewHotel" value="View Hotel"
- action="#{hotelBooking.selectHotel(hot)}"/>
+ <h:column id="column5">
+ <f:facet id="ActionFacet"
name="header">Action</f:facet>
+ <s:link id="viewHotel" value="View Hotel"
action="#{hotelBooking.selectHotel(hot)}"/>
</h:column>
</h:dataTable>
- <s:link value="More results" action="#{hotelSearch.nextPage}"
- rendered="#{hotelSearch.nextPageAvailable}"/>
+ <s:link id="MoreResultsLink" value="More results"
action="#{hotelSearch.nextPage}"
rendered="#{hotelSearch.nextPageAvailable}"/>
</div>
-</a:outputPanel> ]]></programlisting>
+</a:outputPanel>
+]]></programlisting>
<calloutlist>
<callout arearefs="booking-support-element">
- <para> The RichFaces Ajax
<literal><a:support></literal> tag allows a JSF action
+ <para> The RichFaces Ajax
<literal><a:ajax></literal> tag allows a JSF action
event listener to be called by asynchronous
<literal>XMLHttpRequest</literal> when a
JavaScript event like
<literal>onkeyup</literal> occurs. Even better, the
<literal>reRender</literal> attribute
lets us render a fragment of the JSF page and
@@ -2742,20 +2711,14 @@
<div class="section">
<h:form id="room_selections_form">
<div class="section">
- <h:outputText styleClass="output"
- value="No rooms available for the dates selected: "
- rendered="#{availableRooms != null and availableRooms.rowCount ==
0}"/>
- <h:outputText styleClass="output"
- value="Rooms available for the dates selected: "
- rendered="#{availableRooms != null and availableRooms.rowCount >
0}"/>
-
+ <h:outputText styleClass="output" value="No rooms available
for the dates selected: " rendered="#{availableRooms != null and
availableRooms.rowCount == 0}"/>
+ <h:outputText styleClass="output" value="Rooms available
for the dates selected: " rendered="#{availableRooms != null and
availableRooms.rowCount > 0}"/>
<h:outputText styleClass="output"
value="#{booking.checkinDate}"/> -
<h:outputText styleClass="output"
value="#{booking.checkoutDate}"/>
<br/><br/>
- <h:dataTable value="#{availableRooms}" var="room"
- rendered="#{availableRooms.rowCount > 0}">
+ <h:dataTable id="rooms" value="#{availableRooms}"
var="room" rendered="#{availableRooms.rowCount > 0}">
<h:column>
<f:facet name="header">Name</f:facet>
#{room.name}
@@ -2772,8 +2735,7 @@
</h:column>
<h:column>
<f:facet name="header">Action</f:facet>
- <h:commandLink id="selectRoomPreference"
-
action="#{roomPreference.selectPreference}">Select</h:commandLink>
+ <h:commandLink id="selectRoomPreference"
action="#{roomPreference.selectPreference}">Select</h:commandLink>
</h:column>
</h:dataTable>
</div>
@@ -2782,7 +2744,7 @@
<div class="input">
<s:button id="cancel" value="Revise Dates"
view="/book.xhtml"/>
</div>
- </div>
+ </div>
</h:form>
</div>
]]></programlisting>