File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes Very strange behaviour with form based login and css file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Very strange behaviour with form based login and css file" Watch "Very strange behaviour with form based login and css file" New topic
Author

Very strange behaviour with form based login and css file

Adam Kronicki
Ranch Hand

Joined: Sep 01, 2009
Posts: 68
I am using form-based authentication in my JSF webapp and everything was working fine. Until I wanted to enhance the login page to look like the rest of the application - it's only html code, no JSF or JSP tags. However the problem is with the css file and it has 2 levels:
a)the css classes are not loaded at all - everything is plain white with black text
b)when I provide my credentials and hit enter or press the submit button, the pages goes to my css file!!! The url path changes to the css file and I see the file content with classes etc.

Here is my login page:



I wanted to edit the classes for input methods I don't know if this causes the problem (however since the classes are not loaded at all I don't think so):



I tried changing the login file extension from loginpage.jsp to loginpage.html but this did not help. If I delete the link to the css file from page header problem 2 disappears (obviously problem 1 remains). I l have also tried to put all css files in the header <style> tag but then after login, the page redirects to of the pictures used in the css as a background-image. How can I load the css files to the login page?
Adam Kronicki
Ranch Hand

Joined: Sep 01, 2009
Posts: 68
The solution is to change the protected url pattern from /* to i.e. *.faces
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16065
    
  21

There's a chicken-and-egg problem when you attempt to access protected JavaScript and CSS resources from a login page. Since they're protected, you can't get them until you're logged in. But if the login page itself requests protected resources, you're not yet logged in. Eek.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Very strange behaviour with form based login and css file