【问题标题】:Warning on JSF2 and JavaScript - JSF1064: Unable to find or serve resource关于 JSF2 和 JavaScript - JSF1064 的警告:无法找到或提供资源
【发布时间】:2014-08-21 23:09:37
【问题描述】:

在将 JavaScript 和 Css 文件连接到 JSF .xhtml 文件时,谁能告诉我我做错了什么。在部署期间,我收到以下警告:

警告 [javax.enterprise.resource.webcontainer.jsf.application] (http-/127.0.0.1:8080-1) JSF1064:无法从库 css 中找到或提供资源 styles.css。

警告 [javax.enterprise.resource.webcontainer.jsf.application] (http-/127.0.0.1:8080-1) JSF1064:无法从库 javascript 中找到或提供资源 checkPassword.js。

index.xml 代码:

    <?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>

谢谢

【问题讨论】:

    标签: javascript css jsf jsf-2


    【解决方案1】:

    您需要确保将 css/styles.css 文件放在公共 web 内容的 /resources 子文件夹中。

    示例

    WebContent
    -- resources
       -- css
          -- styles.css
    

    【讨论】:

    猜你喜欢
    • 2011-12-23
    • 2014-06-30
    • 2018-01-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-05-16
    • 1970-01-01
    • 2012-03-02
    相关资源
    最近更新 更多