저는 JSF 2.0 리소스 관리 메커니즘을 사용하고 있습니다./webapp/resources 아래에는 이미지, 스크립트, 스타일의 세 가지 하위 폴더가 있습니다.h : outputStylesheet를 사용할 때 렌더링되지 않는 이미지
body {
background: #fff url(../images/body_background.png) repeat -x;
}
#header {
background: transparent url(../images/header_bg.png) no-repeat top right;
}
내 모든 페이지 Facelets에 상주 :
<h:outputStylesheet name="styles/styles.css"/>
나는 다음과 같은 내을 styles.css 파일에있는 모든 내 배경 이미지를 넣어
을 다음과 같이 그리고 내 템플릿 파일 myLayout.xhtml에, 나는 스타일 시트를 참조 하위 폴더/webapp/facelets 아래에 있으며 템플릿 파일은/webapp/template 아래에 있습니다. 내 facelet page.xhtml은 다음과 같이 템플릿을 참조합니다.
<ui:compsition .... template="/template/myLayout.xhtml">
그런 다음 모든 배경 이미지가 누락 된 것을 제외하면 페이지 레이아웃이 적절합니다. 나는 다음과 같은 오류 로그를 확인하고 발견했습니다 다음
java.io.FileNotFoundException: SRVE0190: File not found: /javax.faces.resource/images/body_background.png
java.io.FileNotFoundException: SRVE0190: File not found: /javax.faces.resource/images/header_bg.png
나는/내가
그것은 작동합니다! 정말 고맙습니다! – chaoshangfei
나를 상기시켜 줘서 고마워! 다른 버전의 리소스를 추가하려면이 구문이 여전히 작동합니까? 이제 이미지 파일은/resources/images 대신/resources/default/1_0/images 아래에있게됩니다. – chaoshangfei
라이브러리는'# {resource [ 'default : images/some.png']}'와 같이 접두사가 필요합니다. – BalusC