use*_*667 4 javascript css jsf jsf-2
任何人都可以告诉我在将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.xhml代码:
<?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>
Run Code Online (Sandbox Code Playgroud)
谢谢
小智 7
您需要确保将css/styles.css文件放在public webcontent的/ resources子文件夹中.
例
WebContent
-- resources
-- css
-- styles.css
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
15007 次 |
| 最近记录: |