ArticlesTutorialsInterview Questions & AnswersCertificationsFree Books & Sample ChaptersTechnical Discussions  Your Account | Advertise with us | Feedback |
Few pages of this site are under construction and we are constantly trying to improve it. If you have any suggestions or ideas about how to improve the site, please Let us know.
A first look at Shale Framework - Get started with Shale

A first look at Shale Framework
Get started with Shale    -by Anand K Reddy ,, 06/02/2007

page  3 of 5
Framework Config Files

Now that we have our dependencies in place and a webapp that is configured to use Shale, we'll add some blank configuration files under helloworld/WEB-INF that Shale and JSF will need in order to properly initialize themselves.

The digest-config.xml file is required for nightly build of Shale - the default application filter won't initialize without it.



  "-//Apache Software Foundation//DTD Shale Dialog Configuration 1.0//EN"





<?xml version="1.0" encoding="UTF-8"?>


            <catalog name="shale">

      <!-- Disallow direct access to JSP and JSFP resources -->

      <command      className="org.apache.shale.application.ContextRelativePathFilter"





We only define one rule in our Chain's shale catalog, and that's to disallow direct access to our JSP files. This is because we want to force our users to access the site through the JSF Servlet. We'll also need a faces-config.xml file, but we'll revisit that in next step.

Web App

I know that seems like a lot of work to have gotten nowhere so far; if you ever worked with Struts from scratch I think you'd have thought the same thing about that. We're getting there though, it's finally time to write some code and make some JSPs.

First we'll create a simple NameBean class:

package com.developersBook.jsfApp;

public class NameBean {

            private String name;

            public void setName( final String name )


   = name;        


                  public String getName()





Then we'll create some JSPs. One will prompt for your name, and populate the name bean with the value you enter. The others will say ‘Hello’ or ‘Bye’, depending on which action the user chooses.


<%@ taglib uri="" prefix="h" %>

<%@ taglib uri="" prefix="f" %>



                        <title>Hello World!</title>




                         <h1><h:outputText value="Welcome………"/></h1>

                         <h:form id="helloform">

                         <h:outputText value="Enter your name:"/>

                         <h:inputText value="#{}"/>

                         <h:commandButton action="hello" value="Say Hello"/>

                         <h:commandButton action="bye" value="Say Bye"/>






1|  | 2| 3  |  4  |  5  | Articles Home
About Us | Our Mission | Terms of use | Author Terms |    Search        | Contact Us | Advertise With Us | Link to Us | Sitemap
Copyright © 2016 developersBOOK.COM. All rights reserved.