aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes JSP page Body color not coming green despite specifying in CSS. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "JSP page Body color not coming green despite specifying in CSS." Watch "JSP page Body color not coming green despite specifying in CSS." New topic
Author

JSP page Body color not coming green despite specifying in CSS.

Monica. Shiralkar
Ranch Hand

Joined: Jul 07, 2012
Posts: 639
I have specified in the CSS. Despite that color is white only.where am i going wrong?


loginstyle.css



Login.jsp



thanks
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30353
    
150

Is "background-color: green; " your entire CSS file? It's supposed to go with a selector like "body".


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Monica. Shiralkar
Ranch Hand

Joined: Jul 07, 2012
Posts: 639
No the entire file is :

loginstyle.css


view plaincopy to clipboardprint?
Note: Text content in the code blocks is automatically word-wrapped
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

And are the other two styles in that CSS file doing their work?
Monica. Shiralkar
Ranch Hand

Joined: Jul 07, 2012
Posts: 639
Thanks all.It worked actually but only when I give complete path as



Both login.jsp and loginstyle.css are in the same pages folder inside Web Content.When these are in same folder why cant we write



Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61066
    
  66

Both of those approaches, absolute paths as well as page-relative paths are poor ways to specify the path to a resource in a Java web app. See the ServletsFaq for more information on types of paths and why you should be using a server-relative path.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Monica. Shiralkar
Ranch Hand

Joined: Jul 07, 2012
Posts: 639
Thanks I will See the ServletsFaq for more information on types of paths and why you should be using a server-relative path.

But I am curious to know why does specifying link href as"loginstyle.css" does not work because both are in same Pages folder inside the Web Content.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61066
    
  66

Page-relative URLs are relative to the current URL, not the "current folder" (of which there is no real concept). URLs in web apps are mapped, so they don't actually represent any folder structure. So they are fragile and should not be used.
Monica. Shiralkar
Ranch Hand

Joined: Jul 07, 2012
Posts: 639
Thank you.
 
jQuery in Action, 2nd edition
 
subject: JSP page Body color not coming green despite specifying in CSS.