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:
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.
index.xhml code:
<?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
you need to ensure that the css/styles.css file is been placed in the /resources subfolder of the public webcontent.
Example
WebContent
-- resources
-- css
-- styles.css
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With