How can I include CSS stylesheets relative to context path in JSF 1.1?
<link href="{CONTEXT}/css/style.css" rel="stylesheet" type="text/css"/>
Like we use in JSF2.
<link href="#{resource['css:styles.css']}" rel="stylesheet" type="text/css"/>
Depends on the view technology being used:
If JSP(X), use ${pageContext.request.contextPath}
:
<link href="${pageContext.request.contextPath}/css/style.css" rel="stylesheet" type="text/css"/>
If Facelets 1.x, use #{facesContext.externalContext.requestContextPath}
:
<link href="#{facesContext.externalContext.requestContextPath}/css/style.css" rel="stylesheet" type="text/css"/>
If Facelets 2.x, use #{request.contextPath}
:
<link href="#{request.contextPath}/css/style.css" rel="stylesheet" type="text/css"/>
Note that there's no support for #{resource}
nor <h:outputStylesheet>
in JSF 1.x.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With