HomePage | RecentChanges | Preferences

Facelets is a view technology for JavaServerFaces.


Adventures with Facelets

Following along with the 'Facelets fits JSF like a glove' article and the Facelets documentation...

Install the el-api and el-ri that are shipped with Facelets 1.1.1. No idea what version they *really* are since there is no version number in the filename and nothing in the MANIFEST.MF file. :::sigh::: Laurie mentions that the Facelets build checks out the EL source from the Glassfish repo and builds the jars.

cd /path/to/facelets-1.1.11/lib
mvn install:install-file -DgeneratePom=true -DartifactId=el-api -DgroupId=javax.el -Dversion=1.1.11 -Dfile=el-api.jar -Dpackaging=jar
mvn install:install-file -DgeneratePom=true -DartifactId=el-ri -DgroupId=javax.el -Dversion=1.1.11 -Dfile=el-ri.jar -Dpackaging=jar

A working set of dependencies

$ ls target/acctmtce/WEB-INF/lib
commons-beanutils-1.7.0.jar  el-ri-1.1.11.jar
commons-chain-1.1.jar        jsf-facelets-1.1.11.jar
commons-codec-1.3.jar        jstl-1.1.2.jar
commons-collections-3.1.jar  myfaces-api-1.1.4.jar
commons-digester-1.7.jar     myfaces-impl-1.1.4.jar
commons-el-1.0.jar           oro-2.0.8.jar
commons-lang-2.1.jar         shale-core-1.0.4-SNAPSHOT.jar
commons-logging-1.1.jar      shale-validator-1.0.4-SNAPSHOT.jar
commons-validator-1.3.0.jar  shale-view-1.0.4-SNAPSHOT.jar
el-api-1.1.11.jar            standard-1.1.2.jar

Forms, templates and components are working. Next step is to add back the Shale Validator components.

Facelets and Shale Validator

With this in accessRequest.xhtml

                <h:outputText value="#{messages['prompt.effectiveDate']}"/>
                <h:inputText id="effectiveDate"
                <h:message for="effectiveDate" styleClass="errors"/>

The <s:commonsValidator> tag comes through in the HTML. Fair enough.

So add a Facelets tag file (note that <validator-id> must match what's in the faces-config.xml file for each component):

<?xml version="1.0"?>
<!DOCTYPE facelet-taglib PUBLIC
        "-//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN"

and the corresponding context param in web.xml,

No application errors, but the 'xxx is required' errror message does not display on the page if the form is submitted without a value.

Please ask questions about Facelets and Shale on the appropriate mailing list

HomePage | RecentChanges | Preferences
This page is read-only | View other revisions
Last edited June 8, 2007 6:16 am by WendySmoak (diff)