JSF 2.0 How to Link CSS with External Resources

I was wondering if I can use <h:outputStylesheet/> to bind CSS to external resources. I want to tie yahoo grids. Using the following code, I got RES_NOT_FOUND :

 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:p="http://primefaces.prime.com.tr/ui" xmlns:tcmt="http://java.sun.com/jsf/composite/tcmt/component"> <h:head> </h:head> <h:body> <h:outputStylesheet library="css" name="http://yui.yahooapis.com/3.3.0/build/cssgrids/grids-min.css" target="head" /> </h:body> </html> 
+6
source share
1 answer

I think it is more appropriate to use:

 <link type="text/css" rel="stylesheet" href="http://yui.yahooapis.com/3.3.0/build/cssgrids/grids-min.css" /> 

I'm not sure, but when you use <h:graphicImage/> or <h:outputStylesheet/> , you want to keep in mind some kind of folder that is inside the resources folder, which, for example, has the name css (which will only have style sheets, of course;))

Images:

 <h:graphicImage library="images" name="picuture.jpg" /> 

CSS

 <h:outputStylesheet library="css" name="grids-min.css" target="head" /> 

eg:

  Webcontent
     resources
         images
         // images 
         css
         // stylesheets

My suggestion:

 <link type="text/css" rel="stylesheet" href="http://yui.yahooapis.com/3.3.0/build/cssgrids/grids-min.css" /> 

or you download this .css and put in your CSS folder in resources.

+13
source

Source: https://habr.com/ru/post/892512/


All Articles