关于 JSF2 和 JavaScript 的警告 - JSF1064:无法找到或提供资源
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24509445/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Warning on JSF2 and JavaScript - JSF1064: Unable to find or serve resource
提问by user3793667
Can anybody tell me what am I doing wrong when connecting JavaScript and Css files to JSF .xhtml file. During deployment I have following warnings:
任何人都可以告诉我将 JavaScript 和 Css 文件连接到 JSF .xhtml 文件时我做错了什么。在部署期间,我有以下警告:
WARNING [javax.enterprise.resource.webcontainer.jsf.application] (http-/127.0.0.1:8080-1) JSF1064: Unable to find or serve resource, styles.css, from library, css.
WARNING [javax.enterprise.resource.webcontainer.jsf.application] (http-/127.0.0.1:8080-1) JSF1064: Unable to find or serve resource, checkPassword.js, from library, javascript.
警告 [javax.enterprise.resource.webcontainer.jsf.application] (http-/127.0.0.1:8080-1) JSF1064:无法从库 css 中找到或提供资源 style.css。
警告 [javax.enterprise.resource.webcontainer.jsf.application] (http-/127.0.0.1:8080-1) JSF1064:无法从库、javascript 中找到或提供资源 checkPassword.js。
index.xhml code:
index.xhtml 代码:
<?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:h="http://java.sun.com/jsf/html">
<h:head>
<title>#{msgs.windowTitle}</title>
<h:outputStylesheet library="css" name="styles.css"/>
<h:outputScript library="javascript" name="checkPassword.js"/>
</h:head>
<h:body>
<h:form>
<h:panelGrid columns="2" columnClasses="evenColumns, oddColumns">
#{msgs.namePrompt}
<h:inputText/>
#{msgs.passwordPrompt}
<h:inputSecret id="password"/>
#{msgs.confirmPasswordPrompt}
<h:inputSecret id="passwordConfirm"/>
</h:panelGrid>
<h:commandButton type="button" value="Submit Form"
onclick="checkPassword(this.form)"/>
</h:form>
</h:body>
</html>
Thanks
谢谢
回答by user2618704
you need to ensure that the css/styles.css file is been placed in the /resources subfolder of the public webcontent.
您需要确保 css/styles.css 文件被放置在公共网页内容的 /resources 子文件夹中。
Example
例子
WebContent
-- resources
-- css
-- styles.css