Configuration:web.xml and faces-config.xml

You can tweak the behaviour of BootsFaces by a couple of global parameters in the web.xml.

Mobile support

By default, BootsFaces adds a viewport meta tag needed for a smooth experience on mobile devices:

<meta name="viewport" content="width=device-width, initial-scale=1">

However, if this setting stands in your way, you can deactivate it by setting the context parameter BootsFaces_USE_VIEWPORT to false.

This parameter must not contain EL expressions.

Themes

BootsFaces_THEME selects the Bootstrap theme your application uses. Defaults to (guess what) "default". Legal values are the name of the theme, "default" or "custom". This expression may contain EL expressions. It is evaluated each time a page is rendered.

BootsFaces_USETHEME should always be set to true unless you use your own custom theme. This expression may contain EL expressions. It is evaluated each time a page is rendered.

Use your own version of jQuery, jQueryUI, FontAwesome, or Bootstrap instead of using the version BootsFaces brings

These parameters allow you to replace the built-in version of these libraries by your own libary. For instance, you might prefer to load it from a CDN (hence the name). Setting these parameters to true stops BootsFaces from adding them itself. You have to care about that yourself.

Note that setting net.bootsfaces.get_bootstrap_from_cdn is not recommended because it removes every CSS file dealing with Bootstrap - including the file bsf.css that contains the CSS styles some of the BootsFaces component need. Plus, the parameter does not stop BootsFaces from loading the JavaScript code. In most cases, you are be better of setting the theme to "custom".

Setting the parameters to true stops BootsFaces from adding the resources. These parameters may contain EL expressions are are evaluated each time a page is rendered.

Activate or deactivate the BlockUI features (aka waitcursor)

By default, BlockUI is not activated. You have to activate it by adding a context parameter to the web.xml. This parameter may contain EL expressions. It is evaluated once each time a JSF page is rendered. This allows you to activate or deactivate it on a per-page basis.

Suppress the automatic rendering of labels

By default, BootsFaces renders a label if your provide the label attribute of an input field. However, the label is also used for error messages, so sometimes you need more flexibility. You can deactivate rendering labels globally by setting net.bootsfaces.defaults.renderLabel to false. This parameter may contain EL expression. It is evaluated once each time a page is rendered (i.e. it is request scoped).

Activate the BootsFaces tag decorator

The BootsFaces tag decorator allows you to use a relaxed, HTML5-like coding style in your JSF pages. This feature is described in detail here. To activate the feature, you have to register the decorator in the web.xml:

After registering the decorator, it is active by default. Sometimes that's not the desired behaviour, especially if you have a lot of legacy code that has been written without the decorator in mind.

In this case you can deactivate the decorator by default, and reactivate it on a per-page basis by adding the attribute bootsFacesDecorator="true" to an (almost) arbitrary JSF element:

This expression must not contain EL expressions.