Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

External CSS for JSF

Tags:

css

jsf

external

What is syntax to add external CSS file to jsf?

Tried both ways.Didn't help.

1.

<head>
<style type="text/css">
    @import url("/styles/decoration.css");
</style>
</head>

2.

<head>
    <link rel="stylesheet" type="text/css" href="/styles/decoration.css" />
</head>
like image 780
sergionni Avatar asked Nov 29 '09 15:11

sergionni


1 Answers

The updated JSF 2.0 method is a bit tidier. Instead of:

<link rel="stylesheet" type="text/css" href="#{request.contextPath}/css/compass.css"/>

you now do this:

<h:outputStylesheet library="css" name="compass.css"/>

and the stylesheet resource should be placed in resources\css. Where resources is at the same level as the WEB-INF.

like image 94
simgineer Avatar answered Sep 20 '22 09:09

simgineer