Attention Some notes:
You have multiple ways to download BootsFaces:
Add these lines to your Maven pom.xml build file:
Add these lines to your Gradle build file:
Every once in a while, we publish a developer snapshot for testing and preview purposes. Note that these developer previews are not suited for production. In fact, the main purpose of a developer preview is to give the early adopter of the community an option to test and evaluate new features early, and to tell us about bugs. In other words: we know the previews are buggy, and hope there are enthusiasts helping us to polish the software before it hits the market. The great thing is: usually there are daring developers you give the preview version a try and report us back. More often than not, that boils down to being a lot of work for us, but we really appreciate your help. Thanks, early adopters!
Now that you are aware of the risks, add these lines to your Maven pom.xml build file:
After that, add the dependency to the new version as shown in the first tab, this time adding the suffix -SNAPSHOT
.
If you have not downloaded BootsFaces yet, click here.
Probably the easiest way to get started is to grab one of the demo projects at https://github.com/stephanrauh/BootsFaces-Examples
Alternatively, you can also start from scratch. Open your favorite IDE, start a new project and add the BootsFaces jar you've downloaded to your libraries.
Now, create a new JSF page and make the page header look as follows:
Notice the <!DOCTYPE html>
declaration, needed because BootsFaces makes use of certain HTML elements and CSS properties that require the use of the HTML5 doctype and the xmlns:b="http://bootsfaces.net/ui"
namespace, that enables the use of BootsFaces tags in your JSF page.
You are now ready to develop your project with BootsFaces!
This is a minimal BootsFaces page to get you started:
However, we suggest you start reading the Basic Layout page and have a look at the starter template in the Examples section.
Sometimes the CSS and Javascript files aren't loaded automatically. If you happen to run into this error, you have to add a few lines to the faces-config.xml
and the web.xml
files. Notice that we now recommend to use the CombinedResourceHandler
of OmniFaces. In earlier vesions of BootsFaces we'd recommended other things, but this didn't work out.
Keep the URL patterns of your web application as simple as possible. In this case, the resource files are loaded without further ado. Do not use multiple url-patterns
.
Adding the CombinedResourceHandler
of OmniFaces to the faces-config.xml
can fix nasty resource loading problems:
The BootsFaces_USETHEME context-param in your web.xml controls whether theme.css
is loaded or not.
If you set the parameter to false, BootsFaces delivers a CSS file containing the basic layout instructions. This basic file doesn't contain shadows, decorations or colors, so it looks pretty boring. But it's a good starting point to implement your own look and feel.
Setting the parameter to true causes BootsFaces to load theme.css
, this is true for Bootstrap and Bootswatch Themes.
BootsFaces_THEME
to the name of the theme:If you need more customization you can use the custom value.
Please refer to the Themes page for instructions on Custom Theme.
Most of the time you're probably happy with the binaries available at Maven Central or at the download page. However, it's also possible to build BootsFaces from source. This way, you get our latest bug fixes and the newest components, and you can also contribute bug fixes or components yourself to the project. (Truth to tell you get also our newest bugs. Use at own risk).
The BootsFaces source code is hosted on a GitHub repository. Clone the repository using git (or download the zip file and unpack it to a folder). This folder contains two build files: a Maven pom.xml
and an Gradle build.gradle
. In fact, there are even two Gradle files: the subfolder gradleResources
contains a Gradle build file of its own, which is called by the Gradle build file of the parent project.
The Maven build file is the quick-and-easy solution for most developers. However, it depends on the results of the Gradle build. When the BootsFaces team (or a committer sending us a pull request) changes one of the CSS or JavaScript files, they have to run the Gradle build first. The Gradle build prepares the resources for Maven, which are committed to GitHub. That way, the Maven build is always up-to-date, even if it lacks important parts of the build process.
Cutting a long story short, you're free to use either the Maven or the Gradle build, unless you want to modify the CSS or JavaScript files of BootsFaces.
mvn clean install
on the command line. Most IDEs also offer decent support for Maven. For instance, Eclipse users can import the project via "Import --> Maven --> Existing Maven project".
./gradlew
gradlew.bat
buildResources
(which is inherited from the subproject). After that, run "Gradle assemble" to build the BootsFaces-OSP.jar. You find the jar file in the build
folder of your project.
The script build default is to build the library with the Bootstrap styles and all Bootswatch themes, but you can control what themes you want included setting the bootswatch.theme
property in the build.properties file.
You can also customize the look and feel taking advantage of the build system. There are many Bootstrap customizers on the net other than Bootswatch. What you need is a file with the variables to customize the build. Some customizers will provide you a .less file as well.
Put the files in the gradleResources/less
directory of the build and tweak the bs-* files to use your variables / .less file.
The big tickets of the next versions are: