Prolem with loading themes' images

UI Components for JSF
Post Reply
triverson
Posts: 2
Joined: 25 Jun 2010, 09:52

25 Jun 2010, 10:34

Deal all,

After seeing the new theme of prime facese, I tried to make a demo using the new theme arhitecture, but had some problem with loading the images of the theme.
The demo was using 2.1.RC1-SNAPSHOT from maven repository, and jsf 2.0.2 from mojarra, and the project structure looks like

Code: Select all

src
|-- main
    |-- java
    |-- resources
    |-- webapp
        |-- WEB-INF
        |-- resources
            `-- themes
                `-- ui-lightness
                    |-- images   // the images are located here
                    `-- skin.css
when I use

Code: Select all

<h:outputStylesheet library="themes" name="ui-lightness/skin.css"  />
to load the theme, the css style is loaded, but the images are not, take a look at the firebug output, the page was requesting

Code: Select all

http://localhost:8080/mavenproject1/faces/javax.faces.resource/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png
I think this has something to do with the resource loading mechanism in JSF2.0,
I used to make a workaround by changing the css file, for example, the original

Code: Select all

url(images/ui-bg_glass_100_f6f6f6_1x400.png)
I would change is to

Code: Select all

url(#{request.contextPath}/resources/themes/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png)
but this should not be a good solution, anyone has better idea?

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

25 Jun 2010, 10:57

Can you try using regular link tag;

Code: Select all

<link type="text/css" rel="stylesheet" href="#{request.contextPath}/resources/themes/ui-lightness/skin.css"></link>		

triverson
Posts: 2
Joined: 25 Jun 2010, 09:52

25 Jun 2010, 11:09

Dear cagatay,

It works, thanks very much. Seemes that the resource loading mechanism did not previx the library name, as I mannually input

Code: Select all

http://localhost:8080/mavenproject1/faces/javax.faces.resource/themes/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png
it got the right image, the 'themes' was missed...

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 19 guests