• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

login page - css file loads but images don't

 
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using form-based authentication in my JSF2 webapp on Tomcat. On the login page I use css styling. I learned from previous experience with JSF 1.2 that I need to work on the security constrains, so the page could access the css file on the login page. So I did and the css file is loaded properly. The problem is that the images that are used in the css classes (like background-image: url(../res/img/back.png); ) are not loaded. Surprisingly when I use simple img tag on my login site:
<img src="res/img/back.png">
it works... So the images cannot be loaded only from the css file...

My security constrains are:



This didn't happen it JSF 1.2 Why I the images cannot be loaded in the css file? How to fix this?
 
Ranch Hand
Posts: 426
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Maybe firebug can help you.

Have you tried removing the ../ in your css file?

As far as I know, security constraints are laid up on the protected resource and not on this files. NOt sure though about your case.
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I believe that the URL in the CSS is treated as being relative to the URL from which the CSS file was loaded. And likewise the URL in the element is treated as being relative to the URL from which the HTML was loaded. So check out those URLs and see what the difference is.
 
Adam Kronicki
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I use the same css file and classes in further pages after logging in (.xhtml) and there everything works- the images are loaded. However it seems that for the login .html page the path buts be without 'resources' (the root catalog for css folder, img folder etc.), so now I must in fact have 2 css files which only differ in the img path (the new path doesn't work at .xhtml pages...). Quite annoying to be honest.

 
If you send is by car it's a shipment, but if by ship it's cargo. This tiny ad told me:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic