简体   繁体   English

似乎无法将CSS和JS加载到JSF文件

[英]can't seem to load CSS and JS to JSF files

I'm trying to import a CSS file and a JavaScript file into a JSF file but it doesn't seem to work: 我正在尝试将CS​​S文件和JavaScript文件导入JSF文件,但是它似乎不起作用:

I created the following folders in WebContent and put the files there. 我在WebContent中创建了以下文件夹,并将文件放在那里。

WebContent > resources > css > DBankWebsite30.css And Web内容>资源> CSS> DBankWebsite30.css和
WebContent > resources > js > mainScript18.js WebContent>资源> 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>

Is the web page you are displaying inside the resources folder or is it in the WebContent folder. 是您在资源文件夹中显示的网页还是在WebContent文件夹中。 If in webcontent, you need to link them 如果在网页内容中,则需要链接它们

<h:outputStylesheet name="resources/css/DBankWebsite30.css"/>
<h:outputScript name="resources/js/mainScript18.js"/>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM