You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Brian Ehmann <be...@gmail.com> on 2006/10/05 04:41:45 UTC

Help!! - html problems in jsf

I have a myfaces app that is going to the testers on monday and I  
just ran into a snag, so ANY help would be much appreciated.

The app works great for all of the *.jsp pages.  However I am using  
container managed authentication on tomcat.  When the user tries to  
access any page before they are authenticated, they are forwarded to  
a login.html page.  The login functionality on the page works great,  
however I can not get any of the images on that page to render and  
the page does not find the css stylesheet.  (this is what I get for  
putting the eye-candy off until the last minute).

This is my first myfaces app so I've pretty much followed the  
architecture in the Core JSF (by sun) and Java Server Faces (by  
oreilly).

Does anyone have any ideas?  I can send code and overall design if  
needed but I can't figure out what I am missing here.

Thanks,

Brian

Re: Help!! - html problems in jsf

Posted by David Delbecq <de...@oma.be>.
Brian Ehmann a écrit :
> I have a myfaces app that is going to the testers on monday and I just
> ran into a snag, so ANY help would be much appreciated.
>
> The app works great for all of the *.jsp pages.  However I am using
> container managed authentication on tomcat.  When the user tries to
> access any page before they are authenticated, they are forwarded to a
> login.html page.  The login functionality on the page works great,
> however I can not get any of the images on that page to render and the
> page does not find the css stylesheet.  (this is what I get for
> putting the eye-candy off until the last minute).
>
> This is my first myfaces app so I've pretty much followed the
> architecture in the Core JSF (by sun) and Java Server Faces (by oreilly).
>
> Does anyone have any ideas?  I can send code and overall design if
> needed but I can't figure out what I am missing here.
>
> Thanks,
>
> Brian
Hello,

First, this is not a jsf issue :)
Second, if all of your webapp is under a security constraint requiring
authentification  (you have mapped a security constraint to '/'  or to
'/*' in your web.xml), nothing can be accessed without prior
authentification, that includes your .css and your pictures. If you want
pictures and css accessible from login page, they must be in a non
secure area.
Also, be aware that the url in browser, when doing login
authentification, is always a special url (i can't remember which), not
related to where the login.jsp or login.html page is. As such, if you
have a <webapp>/resources/login.html and <webapp>/resources/my.css, then
you CAN'T use the 'my.css' stylesheet, but use the
'/<webapp>/resources/my.css'


Re: Help!! - html problems in jsf

Posted by Jeff Bischoff <jb...@klkurz.com>.
Brian,

As far as a myfaces-related issue here, I am aware of none. However, our 
company has run into problems similar to what you are describing before, 
on JBoss/Tomcat - our image tags couldn't find the source on (container) 
error pages. Our solution was to use absolute paths to the resources.

You might want to look at the Tomcat groups too.

Regards,

Jeff Bischoff
Kenneth L Kurz & Associates

Brian Ehmann wrote:
> I have a myfaces app that is going to the testers on monday and I just 
> ran into a snag, so ANY help would be much appreciated.
> 
> The app works great for all of the *.jsp pages.  However I am using 
> container managed authentication on tomcat.  When the user tries to 
> access any page before they are authenticated, they are forwarded to a 
> login.html page.  The login functionality on the page works great, 
> however I can not get any of the images on that page to render and the 
> page does not find the css stylesheet.  (this is what I get for putting 
> the eye-candy off until the last minute).
> 
> This is my first myfaces app so I've pretty much followed the 
> architecture in the Core JSF (by sun) and Java Server Faces (by oreilly).
> 
> Does anyone have any ideas?  I can send code and overall design if 
> needed but I can't figure out what I am missing here.
> 
> Thanks,
> 
> Brian
> 
> 
> 



Re: Help!! - html problems in jsf

Posted by Brian Ehmann <be...@gmail.com>.
Wow, do I feel dumb.  Your solution works perfectly.

Thanks for pointing out the obvious to me.  I can't believe I missed it.

- Brian


On Oct 5, 2006, at 2:34 PM, Kevin Galligan wrote:

> Absolute path doesn't matter.  Dave is right.  If you have your css
> files under a protected path, you can't access them until you log in.
>
> Here are a few suggestions.
>
> In your security descriptor, use file extension matching rather than
> path.  Then, just don't match against 'css', 'jpg', and 'gif' files
> (or 'png', 'jpeg', etc).  If you don't match these file extensions,
> you should be able to access them.
>
> If you use path matching, specify the *other* paths in your app.
>
> As for the css, if you pull your login page through the jsp compilier,
> you do a hard include of the css file..
>
> <style>
> <%@ include file="/somepath/your.css"%>
> </style>
>
> On 10/5/06, Tom Innes <To...@alltiers.com> wrote:
>> Try
>>
>> href="#{facesContext.externalContext.requestContextPath}/pages/css/ 
>> styles.cs
>>
>> This makes an absolute path to your style sheet.
>>
>> Tom
>>
>> -----Original Message-----
>> From: Brian Ehmann [mailto:behmannlist@gmail.com]
>> Sent: Wednesday, October 04, 2006 10:42 PM
>> To: MyFaces Discussion
>> Subject: Help!! - html problems in jsf
>>
>> I have a myfaces app that is going to the testers on monday and I
>> just ran into a snag, so ANY help would be much appreciated.
>>
>> The app works great for all of the *.jsp pages.  However I am using
>> container managed authentication on tomcat.  When the user tries to
>> access any page before they are authenticated, they are forwarded to
>> a login.html page.  The login functionality on the page works great,
>> however I can not get any of the images on that page to render and
>> the page does not find the css stylesheet.  (this is what I get for
>> putting the eye-candy off until the last minute).
>>
>> This is my first myfaces app so I've pretty much followed the
>> architecture in the Core JSF (by sun) and Java Server Faces (by
>> oreilly).
>>
>> Does anyone have any ideas?  I can send code and overall design if
>> needed but I can't figure out what I am missing here.
>>
>> Thanks,
>>
>> Brian
>>
>>


Re: Help!! - html problems in jsf

Posted by Kevin Galligan <kg...@gmail.com>.
Absolute path doesn't matter.  Dave is right.  If you have your css
files under a protected path, you can't access them until you log in.

Here are a few suggestions.

In your security descriptor, use file extension matching rather than
path.  Then, just don't match against 'css', 'jpg', and 'gif' files
(or 'png', 'jpeg', etc).  If you don't match these file extensions,
you should be able to access them.

If you use path matching, specify the *other* paths in your app.

As for the css, if you pull your login page through the jsp compilier,
you do a hard include of the css file..

<style>
<%@ include file="/somepath/your.css"%>
</style>

On 10/5/06, Tom Innes <To...@alltiers.com> wrote:
> Try
>
> href="#{facesContext.externalContext.requestContextPath}/pages/css/styles.cs
>
> This makes an absolute path to your style sheet.
>
> Tom
>
> -----Original Message-----
> From: Brian Ehmann [mailto:behmannlist@gmail.com]
> Sent: Wednesday, October 04, 2006 10:42 PM
> To: MyFaces Discussion
> Subject: Help!! - html problems in jsf
>
> I have a myfaces app that is going to the testers on monday and I
> just ran into a snag, so ANY help would be much appreciated.
>
> The app works great for all of the *.jsp pages.  However I am using
> container managed authentication on tomcat.  When the user tries to
> access any page before they are authenticated, they are forwarded to
> a login.html page.  The login functionality on the page works great,
> however I can not get any of the images on that page to render and
> the page does not find the css stylesheet.  (this is what I get for
> putting the eye-candy off until the last minute).
>
> This is my first myfaces app so I've pretty much followed the
> architecture in the Core JSF (by sun) and Java Server Faces (by
> oreilly).
>
> Does anyone have any ideas?  I can send code and overall design if
> needed but I can't figure out what I am missing here.
>
> Thanks,
>
> Brian
>
>

RE: Help!! - html problems in jsf

Posted by Tom Innes <To...@allTiers.com>.
Try

href="#{facesContext.externalContext.requestContextPath}/pages/css/styles.cs

This makes an absolute path to your style sheet.

Tom

-----Original Message-----
From: Brian Ehmann [mailto:behmannlist@gmail.com] 
Sent: Wednesday, October 04, 2006 10:42 PM
To: MyFaces Discussion
Subject: Help!! - html problems in jsf

I have a myfaces app that is going to the testers on monday and I  
just ran into a snag, so ANY help would be much appreciated.

The app works great for all of the *.jsp pages.  However I am using  
container managed authentication on tomcat.  When the user tries to  
access any page before they are authenticated, they are forwarded to  
a login.html page.  The login functionality on the page works great,  
however I can not get any of the images on that page to render and  
the page does not find the css stylesheet.  (this is what I get for  
putting the eye-candy off until the last minute).

This is my first myfaces app so I've pretty much followed the  
architecture in the Core JSF (by sun) and Java Server Faces (by  
oreilly).

Does anyone have any ideas?  I can send code and overall design if  
needed but I can't figure out what I am missing here.

Thanks,

Brian