sly_Chandan
sly_Chandan

Reputation: 3515

Is it possible to use jsf with bootstrap

I have read the book core jsf. I would like to know if I can use bootstrap with jsf.

My question exactly is if jsf server tags have the attributes that are specific to bootstrap. For ex. if h:datatable has css class attribute?

What about other tags like paneled etc?

Upvotes: 0

Views: 1444

Answers (1)

Adam Waldenberg
Adam Waldenberg

Reputation: 2321

Vanilla Bootstrap and JSF

Yes you can use Bootstrap together with JSF. We do so in most of our JSF projects. You can use the standard JSF styleClass attribute to style JSF components with Bootstrap CSS rules (this is equivalent to class in normal HTML.

With that said, there are sometimes some incompatibilities between the way Bootstrap presumes that the HTML is structured and what some of the components actually output. However - be aware that you can use any ordinary HTML tag on a JSF page - so if you hit upon issues - you can often just revert back to the ordinary way of doing things (not using JSF tags or components). Sometimes just sticking a styleClass with the appropriate styling solves things also. You just have to experiment.

Complementing with a Bootstrap-based component framework

If you intend to use Bootstrap, you can use a Bootstrap-based component framework to get around some of the problems you might encounter when using Bootstrap together with the standard JSF components.

There are two to choose from that are under active development;

https://www.bootsfaces.net/

http://www.butterfaces.org/

Both offer JSF Bootstrap components such as buttons, carousels, tables and panels based on the Bootstrap css rules and components.

Upvotes: 1

Related Questions