I am trying to load the css and js files as well as the image in the img
directory from mainStyle.css
but without secuss. I can not load the js file and the obama.jpg
from the css stylesheet.
I am facing a problem to explain why am I getting Hell World! Say apple!
green? I have set them before green but now they have the red value, despite that I am getting them rendered in green!!.
index.xhtml
<!DOCTYPE html>
<html xmlns="htpp://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head>
<title>External resources</title>
<h:outputStylesheet library="css" name="mainStlye.css" />
<h:outputScript library="js" name="mainJS.js" />
</h:head>
<h:body>
<h1>Using external resources</h1>
<div class="message">Hello World!</div>
<div class="message">Say apple!</div>
</h:body>
</html>
mainStyle.css
body{
background: url("#{resource['img/obama.jpg']}");
}
.message{
color:red;
}
mainJS.js
alert('Javascript works fine');