JBoss.orgCommunity Documentation

JBoss AS 6.0 JSF Guide

JSF with JBoss Application Server 6


In this chapter, we demonstrate the world's simplest JSF "Hello World" application.

In this chapter, we cover all the deployment options for your JSF applications.

A new JSF Configuration is useful when you want to add a new JSF implementation to JBoss AS or you just want to enhance an implementation with extra jars such as component libraries. This can save you from bundling the same jars over and over in your WARs.

It's also useful for testing the same application against different JSF implementations, library versions, and configurations. You can create a JSF Configuration and then apply it to your WAR with a a simple context param.

A JSF Configuration consists of some jars and a special web.xml file. When a JSF Configuration is added to a WAR by the JSF Deployer, the jars are added to the classpath and the elements in the web.xml file are activated. To add your own JSF Confguration, just create the directory structure below. This is usually done in the jsf.deployer directory:

Place your jar files in /jsf-libs and place your web.xml in /META-INF. When your JSF Configuration is activated for a WAR, all jars in the jsf-libs directory will be added to the classpath.

The elements in your special META-INF/web.xml file will also be added to your WAR. This can help you configure the JSF implementation and component libraries. However, note that only a few web.xml elements are allowed in this file. These elements are servlet, servlet-mapping, filter, filter-mapping, listener, and context-param. All other web.xml elements are currently ignored, but we may support more in the future.

Table 5.1. 

Context ParamJSF SpecDescriptionDefault Value
javax.faces.CONFIG_FILES1.2 and 2.0Comma-delimited list of faces config files.null
javax.faces.DEFAULT_SUFFIX1.2 and 2.0Change the default suffix for JSP views..jsp
javax.faces.LIFECYCLE_ID1.2 and 2.0ID for alternate Lifecycle implementations.null
javax.faces.STATE_SAVING_METHOD1.2 and 2.0"server" or "client"server
javax.faces.DATETIMECONVERTER _DEFAULT_TIMEZONE_IS _SYSTEM_TIMEZONE2.0Controls if DateTimeConverter instances use the system timezone (if true) or GMT (if false).false
javax.faces.DATETIMECONVERTER _DEFAULT_TIMEZONE_IS _SYSTEM_TIMEZONE2.0Controls if DateTimeConverter instances use the system timezone (if true) or GMT (if false).false
javax.faces.DISABLE_FACELET _JSF_VIEWHANDLER2.0Disables the built-in Facelet ViewHandler. Useful for applications that use legacy Facelets implementation.false
javax.faces.FACELETS_LIBRARIES2.0Semicolon-separated list of paths to Facelet tag libraries.null
facelets.LIBRARIES2.0Semicolon-separated list of paths to Facelet tag libraries. Used for backward-compatibility with legacy Facelets implementation.null
javax.faces.FACELETS_BUFFER_SIZE2.0The buffer size set on the response.-1 (no assigned buffer size)
facelets.BUFFER_SIZE2.0The buffer size set on the response. Used for backward-compatibility with legacy Facelets implementation.-1 (no assigned buffer size)
javax.faces.DECORATORS2.0Semicolon-delimited list of TagDecorator implementations. See javadoc for javax.faces.view .facelets.TagDecorator.null
facelets.DECORATORS2.0Semicolon-delimited list of TagDecorator implementations. Used for backward-compatibility with legacy Facelets implementation.null
javax.faces.FACELETS _REFRESH_PERIOD2.0Time in seconds that facelets should be checked for changes since last request. A value of -1 disables refresh checking.implementation-specific
facelets.REFRESH_PERIOD2.0Time in seconds that facelets should be checked for changes since last request. A value of -1 disables refresh checking. Used for backward-compatibility with legacy Facelets implementation.implementation-specific
javax.faces.FACELETS _RESOURCE_RESOLVER2.0An implementation of javax.faces .view.facelets .ResourceResolver. See javadoc for details.null
facelets.RESOURCE_RESOLVER2.0An implementation of javax.faces .view.facelets .ResourceResolver. See javadoc for details. Used for backward-compatibility with legacy Facelets implementation.null
javax.faces.FACELETS_SKIP _COMMENTS2.0If true, strip XML comments out of Facelets before delivering to the client.false
facelets.SKIP_COMMENTS2.0If true, strip XML comments out of Facelets before delivering to the client. Used for backward-compatibility with legacy Facelets implementation.false
javax.faces.FACELETS_SUFFIX2.0Set the suffix for Facelet xhtml files..xhtml
facelets.SUFFIX2.0Set the suffix for Facelet xhtml files. Used for backward-compatibility with legacy Facelets implementation..xhtml
javax.faces.FACELETS_VIEW_MAPPINGS2.0Semicolon-separated list of Facelet files that don't use the default facelets suffix.null
facelets.VIEW_MAPPINGS2.0Semicolon-separated list of Facelet files that don't use the default facelets suffix. Used for backward-compatibility with legacy Facelets implementation.null
javax.faces.FULL_STATE _SAVING_VIEW_IDS2.0Semicolon-separated list of view IDs that must save state using the JSF 1.2-style state saving.null
javax.faces.INTERPRET_EMPTY _STRING_SUBMITTED_VALUES _AS_NULL2.0If true, consider empty UIInput values to be null instead of empty string.false
javax.faces.PARTIAL_STATE_SAVING2.0If true, use the JSF2 partial state saving for views.false, if WEB-INF/faces-config.xml does not declare JSF 2.0 schema. true, otherwise
javax.faces.PROJECT_STAGE2.0Set the project stage to "Development", "UnitTest", "SystemTest", or "Production".Production
javax.faces.VALIDATE_EMPTY_FIELDS2.0If "true", validate null and empty values. If "auto" validate when JSR-303 Bean Validation is enabled (in AS6 it is enabled by default).auto
javax.faces.validator.DISABLE _DEFAULT_BEAN_VALIDATOR2.0If "true", disable JSR-303 Bean Validation.false

These context params are only valid when using Mojarra JSF.

Table 5.2. 

Context ParamImpl VerDescriptionDefault Value
com.sun.faces. numberOfViewsInSession1.2 and 2.0For server state-saving, how many views, per logical view, can be stored in the session before oldest is removed?15
com.sun.faces.numberOfLogicalViews1.2 and 2.0For server state-saving, how many logical views are allowed before oldest is removed?15
com.sun.faces.preferXHTML1.2 and 2.0Set xhtml as the content type for browsers that support it.false
com.sun.faces.compressViewState1.2 and 2.0Compress the view after serialization but before encoding.false
com.sun.faces.disableVersionTracking1.2 and 2.0If true, don't allow JSF 1.1 implementations of certain interfaces.false
com.sun.faces.sendPoweredByHeader1.2 and 2.0If true, send a header with the JSF spec level.true
com.sun.faces.verifyObjects1.2 and 2.0If true, verify all JSF artifacts (such as managed beans) can be instantiated during initialization.false
com.sun.faces.validateXml1.2 and 2.0If true, perform XML validation on config files.false
com.sun.faces.displayConfiguration1.2 and 2.0If true, log the values of all Mojarra and JSF context params.false
com.sun.faces.injectionProvider1.2 and 2.0Replace the default InjectionProvider implementation. By default this is set by JBoss AS6.org.jboss.web .jsf.integration .injection .JBossDelegatingInjectionProvider
com.sun.faces.injectionProvider1.2 and 2.0Replace the default SerializationProvider implementation.null
com.sun.faces.responseBufferSize1.2 and 2.0Buffer size for writing most generated content.4096
com.sun.faces. clientStateWriteBufferSize1.2 and 2.0Buffer size for writing client state.8192
com.sun.faces.compressJavaScript1.2 and 2.0Remove whitespace from javascript used in standard JSF components.true
com.sun.faces.externalizeJavaScript1.2 and 2.0Allow browsers to cache javascript used in standard JSF components.false
com.sun.faces.enableJSStyleHiding1.2 and 2.0Hide javascript from older browser implementations.false
com.sun.faces.writeStateAtFormEnd1.2 and 2.0Controls if view state is written after opening a form tag (false) or closing a form tag (true).true
com.sun.faces. enableLazyBeanValidation1.2 and 2.0If false, examine managed beans at startup. Otherwise, validate when referenced/created.true
com.sun.faces. enabledLoadBundle11Compatibility1.2 and 2.0Preserve JSF 1.1 behavior of f:loadBundle. See issue here.false
com.sun.faces.clientStateTimeout1.2 and 2.0Time in seconds that client state is considered valid. If a request is received after timeout expired, ViewExpiredException is thrown.null
com.sun.faces.serializeServerState1.2 and 2.0If true, serialize server-side component state.false
com.sun.faces. enableViewStateIdRendering1.2 and 2.0If false, don't render id attribute on javax.faces.ViewState hidden field. See issue here.true
com.sun.faces. enableScriptsInAttributeValues1.2 and 2.0If false, don't allow attribute values with "javascirpt:" or "script:".true
com.sun.faces.disableUnicodeEscaping1.2 and 2.0"false", "true", or "auto". If "auto", escaping depends on response encoding. See issue here.false
com.sun.faces.developmentMode1.2If true, reload Groovy and faces-config files when edited.false
com.sun.faces. enableMultiThreadedStartup1.2If false, don't create worker threads at startup.true
com.sun.faces.enableThreading2.0If false, don't create worker threads at startup.false
com.sun.faces.resourceBufferSize2.0Read buffer size, in bytes, used by the default ResourceHandler implementation.2048
com.sun.faces.defaultResourceMaxAge2.0Time in milliseconds that a resource from the ResourceHandler will be cached via an "Expires" response header. No caching if ProjectStage is "Development".604800
com.sun.faces. resourceUpdateCheckPeriod2.0Frequency in minutes to check for changes to webapp artifacts that contain resources. 0 means never check for changes. -1 means always perform a new lookup when finding resources.5
com.sun.faces.compressableMimeTypes2.0Comma-seperated list of compressable mime types. No compression if ProjectStage is "Development"null
com.sun.faces.expressionFactory2.0Expression factory implementation class.com.sun.el .ExpressionFactoryImpl
com.sun.faces.duplicateJARPattern1.2 and 2.0Regular expression to determine if two URLs point to the same jar. Set by JBoss JSF Deployer.^tmp\d+(\S*\.jar)
com.sun.faces.faceletFactory2.0Set the FaceletFactory impl class.null
com.sun.faces.enableHtmlTagLibValidator2.0Enable validation of standard Html TagLibs.false
com.sun.faces.enableCoreTagLibValidator2.0Enable validation of standard Core TagLibs.false
com.sun.faces. registerConverterPropertyEditors2.0If true, allow EL Coercion to use JSF Custom converters.false
com.sun.faces.enableGroovyScripting2.0If true, allow Groovy.false
com.sun.faces. generateUniqueServerStateIds2.0If true, generate random server state Ids. If false, create Ids sequentially.true
com.sun.faces. autoCompleteOffOnViewState2.0If false, don't use autocomplete="off" when saving view state.true
com.sun.faces.allowTextChildren2.0If true, allow children of h:inputText and h:outputText to be rendered. In 1.2, they would always be rendered before the value of tag. In 2.0, they will not be rendered at all unless this flag is set.false