Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Shale Wiki" for change 
notification.

The following page has been changed by CedricDumoulin:
http://wiki.apache.org/shale/ShaleAndClayTutorial

The comment on the change is:
Remove false links

------------------------------------------------------------------------------
  
  This will build the archetype and install into your local repository so that 
it is available to you.
  
- Create a directory where you want the project, ex.  C:\My projects\ShaleClay. 
Open a shell (CMD) and type in (on one line):
+ Create a directory where you want the project, ex.  C:\My 
projects\Shale``Clay. Open a shell (CMD) and type in (on one line):
  
- mvn archetype:create -DarchetypeGroupId=org.apache.shale.clay 
-DarchetypeArtifactId=clay-starter-archetype -DarchetypeVersion=1.0-SNAPSHOT 
-DgroupId=com.acme.test -DpackageName=com.acme.test -DartifactId=shaleclay
+ mvn archetype:create -D``archetypeGroupId=org.apache.shale.clay 
-D``archetypeArtifactId=clay-starter-archetype 
-D``archetypeVersion=1.0-SNAPSHOT -D``groupId=com.acme.test 
-D``packageName=com.acme.test -D``artifactId=shaleclay
  
  What happens here is that Maven will create a project based on Shale and 
Clay. The parameters are:
  
- * archetypeGroupId –  The archetype groupId[[BR]]
+ * archetype``Group``Id –  The archetype groupId[[BR]]
- * archetypeArtifactId – The archetype artifactId[[BR]]
+ * archetype``Artifact``Id – The archetype artifactId[[BR]]
- * archetypeVersion – The archetype version number[[BR]]
+ * archetype``Version – The archetype version number[[BR]]
- * groupId – The groupId of you project[[BR]]
+ * group``Id – The groupId of you project[[BR]]
- * packageName – The default package name of  your project – included 
source is placed here[[BR]]
+ * package``Name – The default package name of  your project – included 
source is placed here[[BR]]
- * artifactId - The groupId of you project[[BR]]
+ * artifact``Id - The groupId of you project[[BR]]
  
  After you have done his, a project will have been created for you in a 
directory with the same name as you gave for the artifactId. Move to this 
directory.
  
@@ -44, +44 @@

  
  == Lets start ==
  
- Start Eclipse and open a workspace that points to C:\My projects\ShaleClay 
(or wherever you chose as a workspace for this project)
+ Start Eclipse and open a workspace that points to C:\My projects\Shale``Clay 
(or wherever you chose as a workspace for this project)
  
  For Eclipse you now need to import the newly created project into the 
workspace:
  
@@ -56, +56 @@

  
  attachment:ShaleClaydir3.jpg
  
- In the field "Select root directory" enter the name of you workspace or use 
the “Browse..” button to navigate to it. Eclipse should now list all 
available projects. Select the ShaleClay project and hit the “Finish” 
button.
+ In the field "Select root directory" enter the name of you workspace or use 
the “Browse..” button to navigate to it. Eclipse should now list all 
available projects. Select the Shale``Clay project and hit the “Finish” 
button.
  
  You may see a red cross on your projectname if you have not defined the maven 
classpath variable “M2_REPO”. You can add it under "Window-preferences" and 
then "Java-Build Path-Classpath Variables"
  
@@ -135, +135 @@

        <param-value>.jsf</param-value>[[BR]]
     </context-param>[[BR]]
  
- These declarations (context-param) are used by Clay and the JavaServer Faces 
(JSF) implementation at startup.
+ These declarations (context-param) are used by Clay and the Java``Server 
Faces (JSF) implementation at startup.
  
  * javax.faces.DEFAULT_SUFFIX – Tells which page suffixes should be handled 
by JSF[[BR]]
  * javax.faces.STATE_SAVING_METHOD – How should session state be persisted 
(Client-side or Server-side)[[BR]]
@@ -148, +148 @@

     <filter>[[BR]]
        <filter-name>shale</filter-name>[[BR]]
        <filter-class>[[BR]]
-          org.apache.shale.application.faces.ShaleApplicationFilter[[BR]]
+          org.apache.shale.application.faces.Shale``Application``Filter[[BR]]
        </filter-class>[[BR]]
     </filter>[[BR]]
  
@@ -162, +162 @@

  
  Next comes the Servlet definitions. These servlets are instandiated by the 
webcontainer at startup because they have a load-on-startup set. These Servlets 
are responsible for setting up various session and application scoped 
parameters based on the configuration files, and also for receiving all 
requests (That match a pattern) that comes into the webapplication
  
-    <!-- JavaServer Faces Servlet Configuration --> [[BR]]
+    <!-- Java``Server Faces Servlet Configuration --> [[BR]]
     <servlet> [[BR]]
        <servlet-name>faces</servlet-name> [[BR]]
-       <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> [[BR]]
+       <servlet-class>javax.faces.webapp.Faces``Servlet</servlet-class> [[BR]]
        <load-on-startup>1</load-on-startup> [[BR]]
     </servlet> [[BR]]
  
-    <!-- JavaServer Faces Servlet Mapping --> [[BR]]
+    <!-- Java``Server Faces Servlet Mapping --> [[BR]]
     <servlet-mapping> [[BR]]
        <servlet-name>faces</servlet-name> [[BR]]
        <url-pattern>*.jsf</url-pattern> [[BR]]
@@ -277, +277 @@

        <managed-bean>[[BR]]
                <managed-bean-name>messages</managed-bean-name>[[BR]]
                <managed-bean-class>[[BR]]
-                       org.apache.shale.util.LoadBundle[[BR]]
+                       org.apache.shale.util.Load``Bundle[[BR]]
                </managed-bean-class>[[BR]]
                <managed-bean-scope>application</managed-bean-scope>[[BR]]
                <managed-property>[[BR]]
                        <property-name>basename</property-name>[[BR]]
                        <value>[[BR]]
-                               ResourceBundle[[BR]]
+                               Resource``Bundle[[BR]]
                        </value>[[BR]]
                </managed-property>[[BR]]
        </managed-bean>[[BR]]
  
- Here we define the messages bean. In the this case it is a special purpose 
Shale bean. It purpose it to make available to us a resourcebundle that we have 
created. The name of that is ResourceBundle.properties. You will find it the 
folder src/main/resources. This bean is available application wide (given by 
the scope section). It supports internationalization (I18N), so we can have 
several versions of the file where the are unique by their extension (_en, _no 
etc.).
+ Here we define the messages bean. In the this case it is a special purpose 
Shale bean. It purpose it to make available to us a resourcebundle that we have 
created. The name of that is Resource``Bundle.properties. You will find it the 
folder src/main/resources. This bean is available application wide (given by 
the scope section). It supports internationalization (I18N), so we can have 
several versions of the file where the are unique by their extension (_en, _no 
etc.).
  
  Another attribute to note is “allowBody”. This attribute tells Clay 
whether or not to include any content within this tags body or not. Another way 
to achieve the same is through the Clay meta information <!-- ### clay:remove 
### --> <!-- ### /clay:remove ### -->. One of the nice things about this that 
we can have mock content on a page so that during design time w eget the full 
picture, and then have it removed during runtime so that it does not interfere 
with the actual content (Open the page in a browser to see this effect).
  
@@ -364, +364 @@

  
  Clay will when it sees the symbol managed-bean-name, replace it with the 
implicitly mapped bean that Shale is providing. In our case page1.
  
- Lets take a closer look at the bean (com.acme.test.TestVC) that we are using 
for our backing bean. The first thing we notice is that it inherits from fra 
[http://shale.apache.org/shale-view/index.html/ AbstractViewController]. This 
class gives us some hooks (callbacks) into some Shale added lifecycle methods 
so that we can perform certain tasks that are relevant to that particular 
lifecycle. The next thing to notice is that is refers to a class Person. If you 
look in the faces-config.xml file again you will find the following declaration:
+ Lets take a closer look at the bean (com.acme.test.TestVC) that we are using 
for our backing bean. The first thing we notice is that it inherits from  
[http://shale.apache.org/shale-view AbstractViewController]. This class gives 
us some hooks (callbacks) into some Shale added lifecycle methods so that we 
can perform certain tasks that are relevant to that particular lifecycle. The 
next thing to notice is that is refers to a class Person. If you look in the 
faces-config.xml file again you will find the following declaration:
  
        <managed-bean id="person">[[BR]]
                <managed-bean-name>person</managed-bean-name>[[BR]]
@@ -376, +376 @@

  
  If you look at the above definition you will see that Person has been 
declared as a managed bean. Because Person is defined as a managed bean, Shale 
will inject it into our page2 definition because we instructed it to through 
the use of the managed-property section. Since Person has a scope of session it 
will be persisted between request so that any value that we set on one request 
will be available on the next. Finally we see that we define a method sayHello 
on the TestVC bean, and that we refer to that method in the page2Body.html in 
the “action“ attribute (: [EMAIL PROTECTED]).
  
- One of the thing that separate JavaServer Faces from an ordinary 
webapplication is that most interaction with the server is through http POST. 
This means that all fields and actions must be surrounded with a form tag.
+ One of the thing that separate Java``Server Faces from an ordinary 
webapplication is that most interaction with the server is through http POST. 
This means that all fields and actions must be surrounded with a form tag.
  
- Another important thing to notice is that if declare your backing beans to 
extend AbstractViewController you have to declare them with request scope for 
the lifecycle methods to be called. If you declare it with scope session they 
will not be called!
+ Another important thing to notice is that if declare your backing beans to 
extend Abstract``View``Controller you have to declare them with request scope 
for the lifecycle methods to be called. If you declare it with scope session 
they will not be called!
  
  When we do a post against the server JSF/Shale will populate all fields in 
the managed bean that we have associated with fields on the page (There is a 
lot of other things going on too but that is beyond the scope of this 
tutorial). That means that when the method sayHello is invoked a bean Person 
will have been instantiated and filled with the values coming from our page. In 
the method sayHello we do not actually do anything other that return a string. 
This string is used by JSF to figure out which view it should render. This is 
also defined in the faces-config.xml file under the navigation rules section.
  

Reply via email to