Reputation: 619
I'm trying to import a CSS file and a JavaScript file into a JSF file but it doesn't seem to work:
I created the following folders in WebContent and put the files there.
WebContent > resources > css > DBankWebsite30.css And
WebContent > resources > js > mainScript18.js
When I look in the source code of the browser in my web page, the files aren't loaded
<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head>
<h:outputStylesheet name="css/DBankWebsite30.css"/>
<h:outputScript name="js/mainScript18.js"/>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1255"/>
<title>DBank - The best bank</title>
</h:head>
<style>
#content>p
{
font-size:20px;
font-style:italic;
}
</style>
<h:body onload="javascript:setInterval(clock,1000);javascript:buttonClicked();">
<div id="main">
<div id="upper">
<p id="welcomeMessage">Hello guest.</p>
<div id="login">
<a href="LoginPage.html">Login/Logout</a>
</div>
</div>
<div id="left">
<div id="hour"></div>
<ul>
<li id="MainPage" class="mainButtons"><a href="MainPage.xhtml">- Home -</a> <hr/></li>
<li id="Personal" class="mainButtons"><a href="Personal.xhtml">- Personal - </a><hr/></li>
<li id="AboutUs" class="mainButtons"><a href="localHost:8080/MainPage/AboutUsButton.xhtml">- About us -</a><hr/></li>
<li id="ContactUs" class="mainButtons"><a href="localHost:8080/MainPage/ContactUsButton.xhtml">- Contact us -</a><hr/></li>
</ul>
</div>
<div id="content">
<p><h:form> Bank content <h:outputLabel value="bla" /></h:form> </p>
</div>
<div id="bottom">
<p id="rights">DBank © All rights reserved. </p>
</div>
</div>
</h:body>
</html>
Upvotes: 0
Views: 1065
Reputation: 48
Is the web page you are displaying inside the resources folder or is it in the WebContent folder. If in webcontent, you need to link them
<h:outputStylesheet name="resources/css/DBankWebsite30.css"/>
<h:outputScript name="resources/js/mainScript18.js"/>
Upvotes: 1