私のjsfページに背景画像を含めるには多くの方法を試しましたが、どれもうまくいきませんでした。私のページは私のスタイルシートを認識しますが(テキストが赤で表示されるため)、イメージは含まれません。 pom.xmlにマッピングリソースを追加する必要がありますか? お知らせください。背景画像は含まれていません
<h:body class="main">
<h:outputStylesheet library="css" name="index.css"></h:outputStylesheet>
<p class="test"> some text </p>
</h:body>
そして、これは私のstyle.cssです:
This is my folder structure:
`WebContent
|-- META-INF
|-- WEB-INF
|-- resources
| |-- css
| | |-- style.css
| |-- images
| |-- background.png
|-- index.xhtml
これは私がいるindex.xhtmlに追加するものです
.main {
background-image: url("#{resource['images:background.png']}");
}
.test {
color : red;
}
あなたのリソースに 'yourbaseurl/javax.faces.resource/images/background.png'と入力できますか? –
オフトピック(完全ではありません):http://stackoverflow.com/questions/11988415/what-is-the-jsf-resource-library-for-and-how-should-it-be-used – Kukeltje