Author: norman.richards(a)jboss.com
Date: 2008-10-03 15:57:11 -0400 (Fri, 03 Oct 2008)
New Revision: 9185
Modified:
trunk/doc/Seam_Reference_Guide/en-US/Tutorial.xml
Log:
JBSEAM-3026
Modified: trunk/doc/Seam_Reference_Guide/en-US/Tutorial.xml
===================================================================
--- trunk/doc/Seam_Reference_Guide/en-US/Tutorial.xml 2008-10-03 16:24:02 UTC (rev 9184)
+++ trunk/doc/Seam_Reference_Guide/en-US/Tutorial.xml 2008-10-03 19:57:11 UTC (rev 9185)
@@ -4,82 +4,83 @@
<title>Seam Tutorial</title>
<section id="try-examples">
- <title>Try the examples</title>
+ <title>Using the Seam examples</title>
- <para> In this tutorial, we'll assume that you have downloaded JBoss AS
4.2. You should also have a copy of
- Seam downloaded and extracted to a work directory. </para>
+ <para>Seam provides a number of example applications demonstrating how to
use the various features
+ of Seam. This tutorial will guide you through a few of those examples to help
you get started
+ learning Seam. The Seam examples are located in the
<filename>examples</filename> subdirectory
+ 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> The directory structure of each example in Seam follows this
pattern: </para>
+ <para>Each example has the same directory structure:</para>
<itemizedlist>
<listitem>
- <para> Web pages, images and stylesheets may be found in
-
<filename>examples/<replaceable>registration</replaceable>/view</filename>
+ <para> The <filename>view</filename> directory contains
view-related files such as
+ web page templates, images and stylesheets.
+
</para>
</listitem>
<listitem>
- <para> Resources such as deployment descriptors and data import
scripts may be found in
-
<filename>examples/<replaceable>registration</replaceable>/resources</filename>
+ <para> The <filename>resources</filename> directory
contains deployment descriptors and
+ other configuration files.
</para>
</listitem>
<listitem>
- <para> Java source code may be found in
-
<filename>examples/<replaceable>registration</replaceable>/src</filename>
- </para>
+ <para> The <filename>src</filename> directory contains
the application source code. </para>
</listitem>
- <listitem>
- <para> The Ant build script is
-
<filename>examples/<replaceable>registration</replaceable>/build.xml</filename>
- </para>
- </listitem>
+
</itemizedlist>
+ <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.
+ </para>
+
+
+
<section>
<title>Running the examples on JBoss AS</title>
- <para> First, make sure you have Ant correctly installed, with
<literal>$ANT_HOME</literal> and
- <literal>$JAVA_HOME</literal> set correctly. Next, make
sure you set the location of your JBoss AS
- 4.2 installation in the <literal>build.properties</literal>
file in the root folder of your Seam
- installation. If you haven't already done so, start JBoss AS now by
typing <literal>bin/run.sh</literal>
- or <literal>bin/run.bat</literal> in the root directory of
your JBoss installation. </para>
+ <para>The examples are configured for use on JBoss 4.2. 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> Now, build and deploy the example by typing <literal>ant
deploy</literal> in the
-
<filename>examples/<replaceable>registration</replaceable></filename>
directory. </para>
+ <para> Once you've done that and started the application server,
you can build
+ and deploy any example by typing <literal>ant
deploy</literal> in the
+ the directory for that example. The examples all deploy to a URL
+ like
<literal>/seam-<replaceable>example</replaceable></literal>.
+ For the registration example, the URL would be <ulink
url="http://localhost:8080/seam-registration/">
+
<literal>http://localhost:8080/seam-registration/</literal></ulink>.
</para>
- <para> Try it out by accessing <ulink
url="http://localhost:8080/seam-registration/">
-
<literal>http://localhost:8080/seam-registration/</literal>
- </ulink> with your web browser. </para>
-
</section>
<section>
<title>Running the examples on Tomcat</title>
- <para>
- First, make sure you have Ant correctly installed, with
<literal>$ANT_HOME</literal> and
- <literal>$JAVA_HOME</literal> set correctly. Next, make sure
you set the location of your Tomcat
- 6.0 installation in the <literal>build.properties</literal>
file in the root folder of your Seam
- installation. You will need to follow the instructions in <xref
linkend="config.install.embedded"/>
- for installing JBoss Embedded on Tomcat 6.0. JBoss Embedded is required
to run the Seam demo
- applications on Tomcat. (However, it is possible to use Seam on Tomcat
without JBoss Embedded.)
+ <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>
- Now, build and deploy the example by typing <literal>ant
tomcat.deploy</literal> in the
-
<filename>examples/<replaceable>registration</replaceable></filename>
directory.
+ <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>Finally, start Tomcat.</para>
-
- <para>
- Try it out by accessing <ulink
url="http://localhost:8080/jboss-seam-registration/">
-
<literal>http://localhost:8080/jboss-seam-registration/</literal>
- </ulink> with your web browser.
+ <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>
- When you deploy the example to Tomcat, any EJB3 components will run
inside the JBoss Embeddable EJB3
- container, a complete standalone EJB3 container environment.
+ <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>.
</para>
</section>
@@ -87,9 +88,9 @@
<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 testexample</literal> inside the
-
<filename>examples/<replaceable>registration</replaceable></filename>
directory. It is also possible
+ 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.
</para>
</section>
@@ -99,7 +100,7 @@
<section id="registration-example">
<title>Your first Seam application: the registration example</title>
- <para> The registration example is a fairly trivial application that lets a
new user store his username, real
+ <para> The registration example is a simple application that lets a new
user store his username, real
name and password in the database. The example isn't intended to show off
all of the cool functionality of
Seam. However, it demonstrates the use of an EJB3 session bean as a JSF
action listener, and basic
configuration of Seam. </para>
@@ -121,7 +122,8 @@
<section>
<title>Understanding the code</title>
- <para> The example is implemented with two JSP pages, one entity bean
and one stateless session bean. </para>
+ <para> The example is implemented with two Facelets templates, one
entity bean and one
+ stateless session bean. </para>
<mediaobject>
<imageobject role="fo">
@@ -142,7 +144,7 @@
annotations that define the class as a Seam component. </para>
<!-- Can't use code hightlighting with callouts -->
<example>
- <title></title>
+ <title>User.java</title>
<programlistingco>
<areaspec>
<area id="registration-entity-annotation"
coords="1"/>
@@ -286,7 +288,7 @@
<para> This is the only really interesting code in the example!
</para>
<!-- Can't use code hightlighting with callouts -->
<example>
- <title></title>
+ <title>RegisterAction.java</title>
<programlistingco>
<areaspec>
<area id="registration-stateless-annotation"
coords="1"/>
@@ -336,7 +338,7 @@
<calloutlist>
<callout
arearefs="registration-stateless-annotation">
- <para> The EJB standard
<literal>@Stateless</literal> annotation marks this class as
+ <para> The EJB
<literal>@Stateless</literal> annotation marks this class as
a stateless session bean. </para>
</callout>
<callout
arearefs="registration-in-annotation">
@@ -395,20 +397,19 @@
<para> Note that we did not explicitly specify a
<literal>@Scope</literal> this time. Each Seam
component type has a default scope if not explicitly specified.
For stateless session beans, the
- default scope is the stateless context. Actually,
<emphasis>all</emphasis> stateless session
- beans belong in the stateless context. </para>
+ default scope is the stateless context, which is the only
sensible value.</para>
<para> Our session bean action listener performs the business
and persistence logic for our
- mini-application. In more complex applications, we might need to
layer the code and refactor
- persistence logic into a dedicated data access component.
That's perfectly trivial to do. But
- notice that Seam does not force you into any particular strategy
for application layering. </para>
-
- <para> Furthermore, notice that our session bean has
simultaneous access to context associated with
- the web request (the form values in the
<literal>User</literal> object, for example), and state
- held in transactional resources (the
<literal>EntityManager</literal> object). This is a break
- from traditional J2EE architectures. Again, if you are more
comfortable with the traditional
- J2EE layering, you can certainly implement that in a Seam
application. But for many
- applications, it's simply not very useful. </para>
+ mini-application. In more complex applications, we might need
require a separate service
+ layer. This is easy to achieve with Seam, but it's overkill
for most web applications.
+ Seam does not force you into any particular strategy for
application layering, allowing
+ your application to be as simple, or as complex, as you want.
+ </para>
+ <para>Note that in this simple
+ application, we've actually made it far more complex than it
needs to be. If we had
+ used the Seam application framework controllers, we would have
eliminated all of our
+ application code. However, then we wouldn't have had much of
an application to explain.
+ </para>
</section>
@@ -417,7 +418,7 @@
<para>Naturally, our session bean needs a local
interface.</para>
- <example><title></title>
+ <example><title>Register.java</title>
<programlisting role="JAVA"><![CDATA[@Local
public interface Register
{
@@ -425,13 +426,89 @@
}]]></programlisting></example>
- <para> That's the end of the Java code. Now onto the deployment
descriptors. </para>
+ <para> That's the end of the Java code. Now we'll look at
the view.</para>
</section>
<section>
+ <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>
+
+ <example>
+ <title>register.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.com/products/seam/taglib"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core">
+
+ <head>
+ <title>Register New User</title>
+ </head>
+ <body>
+ <f:view>
+ <h:form>
+ <s:validateAll>
+ <h:panelGrid columns="2">
+ Username: <h:inputText value="#{user.username}"
required="true"/>
+ Real Name: <h:inputText value="#{user.name}"
required="true"/>
+ Password: <h:inputSecret value="#{user.password}"
required="true"/>
+ </h:panelGrid>
+ </s:validateAll>
+ <h:messages/>
+ <h:commandButton value="Register"
action="#{register.register}"/>
+ </h:form>
+ </f:view>
+ </body>
+
+</html>]]></programlisting></example>
+
+
+ <para> The only thing here that is specific to Seam is the
+ <literal><s:validateAll></literal> tag.
This JSF component tells JSF to validate all
+ the contained input fields against the Hibernate Validator
annotations specified on the entity bean. </para>
+
+ <example>
+ <title>registered.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:f="http://java.sun.com/jsf/core">
+
+ <head>
+ <title>Successfully Registered New User</title>
+ </head>
+ <body>
+ <f:view>
+ Welcome, #{user.name}, you are successfully registered as #{user.username}.
+ </f:view>
+ </body>
+
+</html>
+]]></programlisting>
+ </example>
+
+
+ <para> This is a simple Facelets page using some embedded EL. There
is nothing specific to Seam
+ here. </para>
+
+ </section>
+
+ <section>
<title>The Seam component deployment descriptor:
<literal>components.xml</literal></title>
+ <para>Since this is the first Seam app we've seen, we'll
take a look at the deployment
+ descriptors. Before we get into them, it is worth noting that Seam
strongly values
+ minimal configuration. These configuration files will be created for
you when you create a Seam
+ application. You'll never need to touch most of these files.
We're presenting them
+ now only to help you understand what all the pieces in the example
are doing.
+ </para>
+
<para> If you've used many Java frameworks before, you'll
be used to having to declare all your
component classes in some kind of XML file that gradually grows more
and more unmanageable as your
project matures. You'll be relieved to know that Seam does not
require that application components
@@ -445,7 +522,7 @@
<literal>WEB-INF</literal> directory. We'll use the
<literal>components.xml</literal> file to tell
Seam how to find our EJB components in JNDI: </para>
<example>
- <title></title>
+ <title>components.xml</title>
<programlisting role="XML"><![CDATA[<?xml
version="1.0" encoding="UTF-8"?>
<components
xmlns="http://jboss.com/products/seam/components"
xmlns:core="http://jboss.com/products/seam/core"
@@ -469,7 +546,8 @@
<para> The presentation layer for our mini-application will be
deployed in a WAR. So we'll need a web
deployment descriptor. </para>
- <example><title></title>
+ <example>
+ <title>web.xml</title>
<programlisting role="XML"><![CDATA[<?xml
version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
@@ -525,7 +603,7 @@
defining our views, so we need to tell JSF to use Facelets as its
templating engine. </para>
<example>
- <title></title>
+ <title>faces-config.xml</title>
<programlisting role="XML"><![CDATA[<?xml
version="1.0" encoding="UTF-8"?>
<faces-config version="1.2"
xmlns="http://java.sun.com/xml/ns/javaee"
@@ -611,75 +689,6 @@
</section>
<section>
- <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>
-
- <example>
- <title></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.com/products/seam/taglib"
-
xmlns:h="http://java.sun.com/jsf/html"
-
xmlns:f="http://java.sun.com/jsf/core">
-
- <head>
- <title>Register New User</title>
- </head>
- <body>
- <f:view>
- <h:form>
- <s:validateAll>
- <h:panelGrid columns="2">
- Username: <h:inputText value="#{user.username}"
required="true"/>
- Real Name: <h:inputText value="#{user.name}"
required="true"/>
- Password: <h:inputSecret value="#{user.password}"
required="true"/>
- </h:panelGrid>
- </s:validateAll>
- <h:messages/>
- <h:commandButton value="Register"
action="#{register.register}"/>
- </h:form>
- </f:view>
- </body>
-
-</html>]]></programlisting></example>
-
-
- <para> The only thing here that is specific to Seam is the
- <literal><s:validateAll></literal> tag.
This JSF component tells JSF to validate all
- the contained input fields against the Hibernate Validator
annotations specified on the entity bean. </para>
-
- <example>
- <title></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:f="http://java.sun.com/jsf/core">
-
- <head>
- <title>Successfully Registered New User</title>
- </head>
- <body>
- <f:view>
- Welcome, #{user.name}, you are successfully registered as #{user.username}.
- </f:view>
- </body>
-
-</html>
-]]></programlisting>
- </example>
-
-
- <para> This is a boring old Facelets page using some embedded EL.
There is nothing specific to Seam
- here. </para>
-
- </section>
-
- <section>
<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>
@@ -779,7 +788,7 @@
flag indicating whether the message has been read: </para>
<example>
- <title></title>
+ <title>Message.java</title>
<programlisting role="JAVA"><![CDATA[@Entity
@Name("message")
@Scope(EVENT)
@@ -855,7 +864,7 @@
stateful session bean. </para>
<!-- Can't use code hightlighting with callouts -->
<example>
- <title></title>
+ <title>MessageManagerBean.java</title>
<programlistingco>
<areaspec>
<area id="messages-datamodel"
coords="7"/>
@@ -886,7 +895,7 @@
@Factory("messageList")
public void findMessages()
{
- messageList = em.createQuery("from Message msg order by msg.datetime
desc")
+ messageList = em.createQuery("select msg from Message msg order by
msg.datetime desc")
.getResultList();
}
@@ -968,7 +977,9 @@
<title>The session bean local interface:
<literal>MessageManager.java</literal></title>
<para> All session beans have a business interface, of course.
</para>
-
+ <example>
+ <title>MessageManager.java</title>
+
<programlisting role="JAVA"><![CDATA[@Local
public interface MessageManager
{
@@ -976,7 +987,7 @@
public void select();
public void delete();
public void destroy();
-}]]></programlisting>
+}]]></programlisting></example>
<para> From now on, we won't show local interfaces in our code
examples. </para>
@@ -993,7 +1004,7 @@
<para> The JSP page is a straightforward use of the JSF
<literal><h:dataTable></literal>
component. Again, nothing specific to Seam. </para>
<example>
- <title></title>
+ <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>
@@ -1048,8 +1059,7 @@
<section>
<title>How it works</title>
- <para> The first time we navigate to the
<literal>messages.jsp</literal> page, whether by a JSF postback
- (faces request) or a direct browser GET request (non-faces request), the
page will try to resolve the
+ <para> The first time we navigate to the
<literal>messages.jsp</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
@@ -1102,7 +1112,7 @@
other transactional behavior). Let's start with the process
definition: </para>
<!-- Can't use code hightlighting with callouts -->
<example>
- <title></title>
+ <title>todo.jpdl.xml</title>
<programlistingco>
<areaspec>
<area id="todo-startstate"
coords="3"/>
@@ -1180,7 +1190,7 @@
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>
- <title></title>
+ <title>Login.java</title>
<programlisting
role="JAVA"><![CDATA[@Name("login")
public class Login {
@@ -1211,7 +1221,9 @@
<para> The JSP itself is trivial: </para>
- <programlisting role="XHTML"><![CDATA[<%@ taglib
uri="http://java.sun.com/jsf/html" prefix="h"%>
+ <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>
@@ -1228,7 +1240,7 @@
</h:form>
</f:view>
</body>
-</html>]]></programlisting>
+</html>]]></programlisting></example>
@@ -1236,7 +1248,7 @@
<!-- Can't use code hightlighting with callouts -->
<example>
- <title></title>
+ <title>TodoList.java</title>
<programlistingco>
<areaspec>
<area id="todo-description"
coords="6"/>
@@ -1289,7 +1301,7 @@
<para> Finally, the meat of the application is in
<literal>todo.jsp</literal>: </para>
<example>
- <title></title>
+ <title>todo.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" %>
<%@ taglib
uri="http://jboss.com/products/seam/taglib" prefix="s"
%>
@@ -1363,7 +1375,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></title>
+ <title>todo.jsp</title>
<programlisting role="XHTML"><![CDATA[<h:form
id="list">
<div>
<h:outputText value="There are no todo items." rendered="#{empty
taskInstanceList}"/>
@@ -1416,12 +1428,11 @@
<s:button value="Done" action="#{todoList.done}"
taskInstance="#{task}"/>
</h:column>]]></programlisting>
- <para> (Note that this is using a Seam
<literal><s:button></literal> JSF control from the
- <literal>seam-ui.jar</literal> package.) </para>
+ <para> Note that this is using a Seam
<literal><s:button></literal> JSF control from the
+ <literal>seam-ui.jar</literal> package. This button is used
to update the properties of the
+ tasks. When the form is submitted, Seam and jBPM will make any changes to
the tasks persistent.
+ There is no need for any action listener method: </para>
- <para> This button is used to update the properties of the tasks. When
the form is submitted, Seam and jBPM
- will make any changes to the tasks persistent. There is no need for any
action listener method: </para>
-
<programlisting role="XHTML"><![CDATA[<h:commandButton
value="Update Items"
action="update"/>]]></programlisting>
<para> A second form on the page is used to create new items, by
calling the action method annotated
@@ -1438,6 +1449,7 @@
configuration and not very interesting. </para>
</section>
+
<section>
<title>How it works</title>
<para>TODO</para>
@@ -1472,7 +1484,7 @@
begin with the pageflow: </para>
<!-- Can't use code hightlighting with callouts -->
<example>
- <title></title>
+ <title>pageflow.jpdl.xml</title>
<programlistingco>
<areaspec>
<area id="numberguess-page" coords="8"/>
@@ -1493,6 +1505,7 @@
<action expression="#{numberGuess.guess}"/>
</transition>
<transition name="giveup" to="giveup"/>
+ <transition name="cheat" to="cheat"/>
</start-page>
<decision name="evaluateGuess"
expression="#{numberGuess.correctGuess}">
@@ -1511,6 +1524,11 @@
<transition name="no" to="displayGuess"/>
</page>
+ <process-state name="cheat">
+ <sub-process name="cheat"/>
+ <transition to="displayGuess"/>
+ </process-state>
+
<page name="win" view-id="/win.jspx">
<redirect/>
<end-conversation/>
@@ -1566,7 +1584,7 @@
<para> Here is the main page of the application,
<literal>numberGuess.jspx</literal>: </para>
<example>
- <title></title>
+ <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"
@@ -1645,7 +1663,7 @@
<para> The <literal>win.jspx</literal> page is predictable:
</para>
<example>
- <title></title>
+ <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"
@@ -1676,11 +1694,12 @@
</example>
- <para> As is <literal>lose.jspx</literal> (which I
can't be bothered copy/pasting). Finally, the JavaBean
- Seam component: </para>
+ <para>The <literal>lose.jspx</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 -->
<example>
- <title></title>
+ <title>NumberGuess.java</title>
<programlistingco>
<areaspec>
<area id="numberguess-create"
coords="13"/>
@@ -1805,7 +1824,10 @@
pageflow definition to use for the conversation's page flow.
</para>
+ <example>
+ <title>pages.xml</title>
+
<programlisting role="XML"><![CDATA[<?xml
version="1.0" encoding="UTF-8"?>
<pages
xmlns="http://jboss.com/products/seam/pages"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -1815,12 +1837,9 @@
<begin-conversation join="true" pageflow="numberGuess"/>
</page>
- <page view-id="/confirm.jspx">
- <begin-conversation nested="true" pageflow="cheat"/>
- </page>
-
</pages>
-]]></programlisting>
+]]></programlisting>
+ </example>
<para> As you can see, this Seam component is pure business logic!
It doesn't need to know anything at all