Dvo*_*ora 1 css jsf composite-component jsf-2
我在JSF2中创建了一个复合组件.我工作得很好.
我想将其创建为JAR以备将来使用.
我按照这里的说明操作.
但是,当涉及到CSS时,浏览器会引用相对于使用jar而不是Jar位置的项目的位置!
我这样定义:
<h:outputStylesheet library="css" name="component.css" target="head" />
Run Code Online (Sandbox Code Playgroud)
我得到这个例外: GET http://localhost:8080/MY_APPLICATION/resources/component.css 404 (Not Found)
它正在寻找相对于项目而不是Jar项目!
我怎样才能相对于JAR项目?
EDITED
JAR树是:
META-INF
--resource
-- components
myComp.xhtml
components.css
-- img
-- scripts
--components.taglib.xml
--faces.config.xml
Run Code Online (Sandbox Code Playgroud)
战争是一个有规律的动态项目:
WEB-INF
--lib
myJar.jar
-- web.xml
-- faces-config.xml
testComp.xhtml
Run Code Online (Sandbox Code Playgroud)
您的JAR目录结构应该是:
META-INF
--resources
-- components
myComp.xhtml
-- css <-- The library defined in the stylesheet
components.css <-- A stylesheet resource in the library
-- img
-- scripts
--components.taglib.xml
--faces.config.xml
Run Code Online (Sandbox Code Playgroud)
因为,你指定库名称css在h:outputStylesheet与资源名称作为标签component.css,文件应该存在于一个名为css位于META-INF/resourcesJAR文件的目录.
另外,如果您打算允许其他开发人员使用您的JAR,请考虑使用不会与其他名称冲突的库名.
| 归档时间: |
|
| 查看次数: |
3571 次 |
| 最近记录: |