JavaServer Faces (JSF) - JSF Basic Tags - JSF h:outputStylesheet - JavaServer Faces (JSF)

What is JSF h:outputStylesheet?

The h:outputStylesheet tag renders an HTML element of the type "link" with type "text/css". This tag is used to add external stylesheet file to JSF page.

JSF Tag

Rendered Output

Example Application

A test JSF application is created to test the above tag.

Step
Description
1
Create a project with a namehelloworldunder a packagecom.wisdomjobs.testas explained in theJSF - First Applicationchapter.
2
Createresourcesfolder undersrc mainfolder.
3
Createcssfolder undersrc main resourcesfolder.
4
Createstyles.cssfile undersrc main resources cssfolder.
5
Modifystyles.cssfile as explained below.
6
Modifypom.xmlas explained below.
7
Modifyhome.xhtmlas explained below. Keep rest of the files unchanged.
8
Compile and run the application to make sure business logic is working as per the requirements.
9
Finally, build the application in the form of war file and deploy it in Apache Tomcat Webserver.
10
Launch your web application using appropriate URL as explained below in the last step.

styles.css

pom.xml

home.xhtml

Once all the changes are done, the application is compiled and run as in JSF – Create Application chapter. On successful creation of the application, the result appears as:

JSF outputStylesheet

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

JavaServer Faces (JSF) Topics