You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by mm...@apache.org on 2007/12/15 19:11:37 UTC

svn commit: r604474 - /myfaces/site/trunk/src/site/apt/index.apt

Author: mmarinschek
Date: Sat Dec 15 10:11:37 2007
New Revision: 604474

URL: http://svn.apache.org/viewvc?rev=604474&view=rev
Log:
include new content on the myfaces main website

Modified:
    myfaces/site/trunk/src/site/apt/index.apt

Modified: myfaces/site/trunk/src/site/apt/index.apt
URL: http://svn.apache.org/viewvc/myfaces/site/trunk/src/site/apt/index.apt?rev=604474&r1=604473&r2=604474&view=diff
==============================================================================
--- myfaces/site/trunk/src/site/apt/index.apt (original)
+++ myfaces/site/trunk/src/site/apt/index.apt Sat Dec 15 10:11:37 2007
@@ -4,18 +4,108 @@
 
 Welcome to the Apache MyFaces Project 
 
-	This is the official homepage of the first free open source
-	Java Server Faces implementation called "Apache MyFaces".
+	Apache MyFaces is a project of the Apache Software Foundation,
+	and hosts several sub-projects relating to the JavaServer(tm) technology.
 
-	<<What is Java Server Faces (JSF)?>>
-      
-	Java Server Faces is a new and upcoming web application
-	framework that accomplishes the MVC paradigm. It is comparable
-	to the well-known
-	{{{http://struts.apache.org}Struts Framework}}
-	but has features and concepts that are beyond those of Struts - 
-	especially the component orientation. 
+	The Apache MyFaces project provides:
+
+	* a JavaServer(tm) Faces implementation (core module)
 	
+	* several component libraries (e.g. MyFaces Tomahawk, MyFaces Trinidad, MyFaces Tobago)
+
+	* extension packages to JavaServer(tm) Faces (e.g. MyFaces Orchestra)
+
+  <<What is JavaServer(tm) Faces (JSF)?>>
+      
+	JavaServer(tm) Faces is the well-established standard for web-development
+	frameworks in Java. The standard is based on the MVC paradigm, but is additionally
+	to most web-frameworks also component-based and event-oriented.
+
+	In JSF, the first step to build web-applications is to create a page-structure by arranging
+	JSF components in a tree. For defining this page-structure, different templating languages
+	can be used. In the standard, JSP is used, other options include XML based templating languages
+	like Shale Clay or Facelets.
+
+	A very short example for a typical JSF-view would be the following:
+
++------------------------------------------------------------------------+
+<html>
+    <head>
+    </head>
+    <body>
+        <f:view>
+            <h:form id="mainForm">
+                <h:outputLabel for="enterName" value="Enter Name"/>
+                <h:inputText id="enterName" value="#{sayHelloPage.name}"/>
+                <h:commandButton value="Say Hello" action="#{sayHelloPage.sayHello}"/>
+            </h:form>
+        </f:view>
+    </body>
+</html>
++------------------------------------------------------------------------+
+
+    This example shows the basic setup of a typical JSF-page: an \<f:view/\>-tag is the root-component
+    of the JSF page - in many cases, you want to put a form into the tree right after this root-component
+    (in JSF, all input and command-components need a form wrapped around them, also the commandLink-component).
+
+    Finally, the page structure consists of a label-component, a data-entry component and a button to submit
+    the changes.
+
+    The next step in building a JSF-application is to wire up these components with the backing-beans. This
+    wiring is done using the expression-language of JSF, the Unified EL (this EL is also used in the
+    JSP templating technology). EL-expressions usually refer to Java-bean instances defined in a JSF configuration
+    file, the faces-config.xml.
+
+    The EL-expression #{sayHelloPage.name} would refer to the property "name" of the managed-bean "sayHelloPage".
+    To be able to refer to this managed bean, you would need to add the following section to your configuration-file
+    (found under /WEB-INF/) faces-config.xml:
+
++------------------------------------------------------------------------+
+<managed-bean>
+    <managed-bean-name>sayHelloPage</managed-bean-name>
+    <managed-bean-class>demo.SayHelloPage</managed-bean-class>
+    <managed-bean-scope>request</managed-bean-scope>
+</managed-bean>
++------------------------------------------------------------------------+
+
+    Finally, for completing the first page of your
+    JSF-application, you would need to write a Java-class like the following:
+
++------------------------------------------------------------------------+
+public class SayHelloPage {
+    private String name;
+
+    public void setName(String name) { this.name = name; }
+    public String getName() { return name }
+
+    public String sayHello() {
+        return "success";
+    }
+
+}
++------------------------------------------------------------------------+
+
+    JSF managed-beans are POJOs - you do not have to inherit from any special
+    base-classes, just provide a public no-argument constructor, add your
+    properties and you are ready to go. The method sayHello in the above class
+    is (in the page template) bound to the command-button "Say Hello" via the
+    action attribute of this button. On every click on the command-button, this method will be
+    executed (it is the event-listener for the click on the button), it is an
+    action method. From this method, you can return a string -
+    the string returned from an action-method will then be used by the JSF
+    navigation system to determine to what page the JSF-engine needs to move on.
+
++------------------------------------------------------------------------+
+<navigation-rule>
+    <from-view-id>/page1.jsp</from-view-id>
+    <navigation-case>
+        <from-outcome>success</from-outcome>
+        <to-view-id>/page2.jsp</to-view-id>
+    </navigation-case>
+</navigation-rule>
++------------------------------------------------------------------------+
+
+
 	Look at	{{{http://java.sun.com/j2ee/javaserverfaces} Sun's JSF Page}}
 	to learn more about the
 	{{{http://www.jcp.org/en/jsr/detail?id=127}Java Specification Request 127}}
@@ -26,12 +116,11 @@
 
     * Make sure to have a look at our examples - you can find a
     working distribution 
-    {{{http://www.irian.at/myfaces.jsf}here}}. 
+    {{{http://www.irian.at/myfaces/}here}}.
     
     * Find instructions on installing them yourselves in our
-    'Getting Started' section. If you can't find information you
-    need on these pages, make sure you also go to our 
-    {{{http://wiki.apache.org/myfaces}WIKI}}
+    'Getting Started' section. For additional information, you can refer
+    to our {{{http://wiki.apache.org/myfaces}WIKI}}
 
 July 17, 2007 - MyFaces Core 1.2.0 Released