JSF OutputStylesheet Example
The JSF OutputStyleSheet renders an HTML <link> tag of type “text/css”. Below is the
h:OutputStylesheet and its corresponding HTML tags.
JSF => <h:outputStylesheet name=”style/template.css” />
HTML => <link type=”text/css” rel=”stylesheet” href=”/JSF_OutputStylesheet_Example/faces/javax.faces.resource/style/template.css” />
JSF h:OutputStylesheet Example
Create a folder ‘resources’ under WebContent directory and place the CSS files over there as shown below. Below are the style.css and the index.xhtml file
Highlight-1). The style/template.css file is residing under the resources directory
Highlight-2). The JSF <H:ouputStylesheet> pointing to the stylesheet
Highlight-3) The button component has the styleClass attribute which is a CSS class present in the template.css
Below is the content of the template.css file. The CSS class sets background color Yellow.
Below is how the page looks like in the browser
Download the JSF Project:
The views expressed on this blog are my personal views and do not necessarily reflect the views of my employer.
Please feeling free to reach me on any comments and feedbacks you have. Would be more than glad to listen and reply 🙂
Latest posts by Govind
- Is it possible to logout Primavera P6 through SQL Query? - February 16, 2018
- How to Create Primavera P6 EPPM Database schemas in Microsoft SQL Server - February 15, 2018
- Configure Windows Firewall for Microsoft SQL Server 2017 – Part 4 - February 14, 2018