Author: artdaw
Date: 2008-10-10 11:11:46 -0400 (Fri, 10 Oct 2008)
New Revision: 10720
Modified:
trunk/docs/cdkguide/en/src/main/docbook/modules/overview.xml
Log:
https://jira.jboss.org/jira/browse/RF-3692 - "Component usage overview" chapter
done
Modified: trunk/docs/cdkguide/en/src/main/docbook/modules/overview.xml
===================================================================
--- trunk/docs/cdkguide/en/src/main/docbook/modules/overview.xml 2008-10-10 14:52:46 UTC
(rev 10719)
+++ trunk/docs/cdkguide/en/src/main/docbook/modules/overview.xml 2008-10-10 15:11:46 UTC
(rev 10720)
@@ -11,19 +11,172 @@
</chapterinfo>
<title>Component usage overview</title>
<para>
- After the <emphasis
role="bold"><property><inputDate></property></emphasis>
component creation you could use it on a page.
- Let's create a simple JSF project with the help of
<code>maven-archetype-jsfwebapp</code> archetype.
+ After the <emphasis
role="bold"><property><inputDate></property></emphasis>
component has been created you could use it on a page.
+ Create a simple JSF project with only one JSP page that has a form with our
+ <emphasis
role="bold"><property><inputDate></property></emphasis>
component.
+
</para>
- <para>
- </para>
+ <section id="jsppage">
+ <title>JSP Page</title>
+ <para>
+ Here is the necessary page (index.jsp):
+ </para>
+
+ <programlisting role="XML"><![CDATA[
+<%@ taglib
uri="http://java.sun.com/jsf/html" prefix="h"%>
+<%@ taglib
uri="http://java.sun.com/jsf/core" prefix="f"%>
+<%@ taglib
uri="http://mycompany.org/inputDate" prefix="my"%>
+<html>
+ <head>
+ <title>My inputDate</title>
+ </head>
+ <body>
+ <f:view>
+ <h:form>
+ <my:inputDate value="#{bean.text}">
+ <f:facet name="caption">
+ <f:verbatim>
+ Calendar:
+ </f:verbatim>
+ </f:facet>
+ </my:inputDate>
+ <h:commandButton value="Submit" />
+ </h:form>
+ </f:view>
+ </body>
+</html>
+]]></programlisting>
+ </section>
+ <section id="dataBean">
+ <title>Data Bean</title>
+ <para>
+ In order to build this application, you should create a managed bean:
+ </para>
+
+ <programlisting role="JAVA"><![CDATA[
+package myapp;
+import java.util.Date;
+public class Bean {
+
+ private Date text = null;
+
+ public Bean() {
- <section id="devsample">
+ }
+
+ public Date getText() {
+ return text;
+ }
+
+ public void setText(Date text) {
+ this.text = text;
+ }
+}
+]]></programlisting>
+ </section>
+ <section id="facesconfig">
+ <title>faces-config.xml</title>
+ <para>
+ It is necessary to register your bean inside of the
<property>faces-config.xml</property> file:
+ </para>
+
+ <programlisting role="XML"><![CDATA[
+<?xml version="1.0" encoding="UTF-8"?>
+<faces-config
+
xmlns="http://java.sun.com/xml/ns/javaee"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"
+ version="1.2">
+ <managed-bean>
+ <managed-bean-name>bean</managed-bean-name>
+ <managed-bean-class>myapp.Bean</managed-bean-class>
+ <managed-bean-scope>request</managed-bean-scope>
+ </managed-bean>
+</faces-config>
+]]></programlisting>
+ </section>
+ <section id="Webxml">
+ <title>Web.xml</title>
+ <para>
+ It is also necessary to take following steps:
+ </para>
+ <itemizedlist>
+ <listitem>
+ <para>
+ add necessary jar files
+ (inputDate-1.0-SNAPSHOT.jar, jsf-api.jar, jsf-impl.jar, jstl-api-1.2.jar,
richfaces-api-3.3.0.jar, richfaces-impl-3.3.0.jar, richfaces-ui-3.3.0.jar,
commons-logging.jar, commons-digester.jar, commons-collections.jar, commons-beanutils.jar,
common-annotations.jar)
+ into the <property>WEB-INF/lib</property> folder
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ modify the <property>web.xml</property> file:
+ </para>
+ <programlisting role="XML"><![CDATA[
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID"
version="2.5">
+ <display-name>app</display-name>
+ <context-param>
+ <param-name>javax.faces.CONFIG_FILES</param-name>
+ <param-value>/WEB-INF/faces-config.xml</param-value>
+ </context-param>
+ <context-param>
+ <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
+ <param-value>server</param-value>
+ </context-param>
+ <servlet>
+ <servlet-name>Faces Servlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>*.jsf</url-pattern>
+ </servlet-mapping>
+ <login-config>
+ <auth-method>BASIC</auth-method>
+ </login-config>
+ <filter>
+ <display-name>RichFaces Filter</display-name>
+ <filter-name>richfaces</filter-name>
+ <filter-class>org.ajax4jsf.Filter</filter-class>
+ </filter>
+ <filter-mapping>
+ <filter-name>richfaces</filter-name>
+ <servlet-name>Faces Servlet</servlet-name>
+ <dispatcher>REQUEST</dispatcher>
+ <dispatcher>FORWARD</dispatcher>
+ <dispatcher>INCLUDE</dispatcher>
+ </filter-mapping>
+</web-app>
+]]></programlisting>
+ </listitem>
+ </itemizedlist>
+ </section>
+ <section id="deployment">
+ <title>Deployment</title>
+ <para>
+ Finally, you should be able to place this application on your Web server.
+ To start your project, point your browser at <ulink
url="http://localhost:8080/myapp/index.jsf">http://localhost:8080/myapp/index.jsf</ulink>.
+ </para>
+ </section>
+
+ <!-- section id="devsample">
<title>Developer sample creation</title>
<para>
- Work in progress...
+ Let's create a simple JSF project, called
<property>myapp</property> for example,
+ with the help of <code>maven-archetype-jsfwebapp</code> archetype.
</para>
- </section>
+ <para>
+ It is necessary to proceed to your <property>Sandbox</property>
directory and launch the following command (all in one line):
+ </para>
+ <programlisting role="XML"><![CDATA[mvn archetype:create
-DarchetypeGroupId=org.richfaces.cdk -DarchetypeArtifactId=maven-archetype-jsfwebapp
-DarchetypeVersion=3.3.0-SNAPSHOT -DgroupId=org.mycompany
-DartifactId=myapp]]></programlisting>
+ <para>
+ As easy to see a new directory <property>myapp</property> is created
with the predefined JSF project structure:
+ </para>
+ </section-->
</chapter>