[jboss-cvs] jboss-seam/doc/reference/en/modules ...
Gavin King
gavin.king at jboss.com
Thu Jun 21 19:46:58 EDT 2007
User: gavin
Date: 07/06/21 19:46:57
Modified: doc/reference/en/modules tutorial.xml
Log:
update
Revision Changes Path
1.90 +86 -62 jboss-seam/doc/reference/en/modules/tutorial.xml
(In the diff below, changes in quantity of whitespace are not shown.)
Index: tutorial.xml
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/doc/reference/en/modules/tutorial.xml,v
retrieving revision 1.89
retrieving revision 1.90
diff -u -b -r1.89 -r1.90
--- tutorial.xml 18 Jun 2007 22:17:15 -0000 1.89
+++ tutorial.xml 21 Jun 2007 23:46:57 -0000 1.90
@@ -61,7 +61,13 @@
</para>
<para>
- Next, follow the instructions for installing JBoss Embedded on Tomcat 6.0 ... TBD!
+ Next, follow the
+ <ulink url="http://wiki.jboss.org/wiki/Wiki.jsp?page=EmbeddedAndTomcat">instructions</ulink>
+ for installing JBoss Embedded on Tomcat 6.0. (This is a straightforward process, you need
+ to copy some jars and files into the Tomcat <literal>lib/</literal> directory, and then
+ edit <literal>conf/server.xml</literal> and <literal>conf/context.xml</literal>, adding
+ the configurations required to bootstrap JBoss Embedded and enable scanning of WARs for
+ EJB components and datasources.)
</para>
<para>
@@ -445,9 +451,16 @@
Seam how to find our EJB components in JNDI: </para>
<example>
- <programlisting><![CDATA[<components xmlns="http://jboss.com/products/seam/components"
- xmlns:core="http://jboss.com/products/seam/core">
+ <programlisting><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
+<components xmlns="http://jboss.com/products/seam/components"
+ xmlns:core="http://jboss.com/products/seam/core"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation=
+ "http://jboss.com/products/seam/core http://jboss.com/products/seam/core-1.3.xsd
+ http://jboss.com/products/seam/components http://jboss.com/products/seam/components-1.3.xsd">
+
<core:init jndi-pattern="@jndiPattern@"/>
+
</components>]]></programlisting>
</example>
@@ -489,7 +502,7 @@
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
- <param-value>.jspx</param-value>
+ <param-value>.xhtml</param-value>
</context-param>
<servlet>
@@ -519,8 +532,9 @@
<section>
<title>The JSF configration: <literal>faces-config.xml</literal></title>
- <para> All Seam applications use JSF views as the presentation layer. So we'll need
- <literal>faces-config.xml</literal>. </para>
+ <para> Most Seam applications use JSF views as the presentation layer. So usually we'll need
+ <literal>faces-config.xml</literal>. In our case, we are going to use Facelets for
+ defining our views, so we need to tell JSF to use Facelets as its templating engine. </para>
<example id="registration-faces-config-xml">
<programlisting><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
@@ -529,18 +543,21 @@
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">
- <!-- This one is empty, it's a very simple application! -->
+ <!-- Facelets support -->
+ <application>
+ <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
+ </application>
</faces-config>]]></programlisting>
</example>
<para> Note that we don't need
- any JSF managed bean declarations! The managed beans are the Seam components. In Seam applications,
+ 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. </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 the navigation rules, and
- possibly jBPM process definitions. Seam takes the view that <emphasis>process flow</emphasis> and
+ need to write as you add new functionality to a Seam application is orchestration: navigation rules
+ or jBPM process definitions. Seam takes the view that <emphasis>process flow</emphasis> and
<emphasis>configuration data</emphasis> are the only things that truly belong in XML. </para>
<para> In this simple example, we don't even need a navigation rule, since we decided to embed the view
@@ -602,18 +619,20 @@
</section>
<section>
- <title>The view: <literal>register.jsp</literal> and <literal>registered.jsp</literal></title>
+ <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 JSP, since it is familiar to most developers and since we have minimal
- requirements here anyway. (But if you take our advice, you'll use Facelets for your own
- applications.) </para>
+ JSF. In this example we use Facelets, because we think it's better than JSP.</para>
<example id="registration-simpleform">
- <programlisting><![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" %>
-<html>
+ <programlisting><![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>
@@ -624,23 +643,24 @@
<s:validateAll>
<tr>
<td>Username</td>
- <td><h:inputText value="#{user.username}"/></td>
+ <td><h:inputText value="#{user.username}" required="true"/></td>
</tr>
<tr>
<td>Real Name</td>
- <td><h:inputText value="#{user.name}"/></td>
+ <td><h:inputText value="#{user.name}" required="true"/></td>
</tr>
<tr>
<td>Password</td>
- <td><h:inputSecret value="#{user.password}"/></td>
+ <td><h:inputSecret value="#{user.password}" required="true"/></td>
</tr>
</s:validateAll>
</table>
<h:messages/>
- <h:commandButton type="submit" value="Register" action="#{register.register}"/>
+ <h:commandButton value="Register" action="#{register.register}"/>
</h:form>
</f:view>
</body>
+
</html>]]></programlisting>
</example>
@@ -649,23 +669,27 @@
the contained input fields against the Hibernate Validator annotations specified on the entity bean. </para>
<example id="registration-simplepage">
- <programlisting><![CDATA[<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
-<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
-<html>
+ <programlisting><![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, <h:outputText value="#{user.name}"/>,
- you are successfully registered as <h:outputText value="#{user.username}"/>.
+ Welcome, #{user.name}, you are successfully registered as #{user.username}.
</f:view>
</body>
-</html>]]></programlisting>
+
+</html>
+]]></programlisting>
</example>
- <para> This is a boring old JSP pages using standard JSF components. There is nothing specific to Seam
+ <para> This is a boring old Facelets page using some embedded EL. There is nothing specific to Seam
here. </para>
</section>
@@ -733,8 +757,8 @@
outcome is returned, causing a page redisplay. The <literal>FacesMessages</literal> component
interpolates the JSF expression embedded in the message string and adds a JSF
<literal>FacesMessage</literal> to the view. </para>
- <para> If no user with that username exists, the <literal>"/registered.jspx"</literal> outcome triggers a
- browser redirect to the <literal>registered.jsp</literal> page. When JSF comes to render the page, it
+ <para> If no user with that username exists, the <literal>"/registered.xhtml"</literal> outcome triggers a
+ browser redirect to the <literal>registered.xhtml</literal> page. When JSF comes to render the page, it
asks Seam to resolve the variable named <literal>user</literal> and uses property values of the returned
<literal>User</literal> entity from Seam's session scope. </para>
More information about the jboss-cvs-commits
mailing list