Reputation: 619
In html it is working perfectly , but I'm guessing it's not the same for a JSF file. I'm trying to change the background color of body, to have a background color for my webPage but it doesn't seem to work, Here is my code:
<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1255"/>
<title>Welcome</title>
</h:head>
<h:body style="background-color:blue;">
</h:body>
</html>
Upvotes: 0
Views: 7904
Reputation: 1109874
You need to make sure that the request URL as you see in the browser's address bar matches the <url-pattern>
of the FacesServlet
as you've configured in your web.xml
. Otherwise the JSF tags won't be parsed and won't produce the desired HTML output. You can confirm this by doing rightclick and View Source in webbrowser. Instead of <body>
the webbrowser would receive a <h:body>
which it doesn't understand. You should not be seeing any JSF tags over there but instead its generated HTML output.
Imagine that it is <url-pattern>*.jsf</url-pattern>
, then you should be opening the page as http://example.com/context/page.jsf instead of http://example.com/context/page.xhtml.
Otherwise, you'd better change the <url-pattern>
to *.xhtml
so that you never need to fiddle with virtual URLs.
Upvotes: 1
Reputation: 2538
instead of using inline CSS style you can define your style for body tag
body {
background-color:blue;
}
Upvotes: 2
Reputation: 364
You can use the following jQuery code to change the colour of the body tag.(it works)
Actually your page is being added within another body tag... so by changing the body, you are not changing the real body's attributes.
JQuery helps you in almost everything.
$( document ).ready(function()
{
$('body').css('background', 'blue');
});
Upvotes: 0
Reputation: 5913
You have an empty page that results in an empty body which is not displayed. Either put something in your body or change the style to:
style="width: 100%; height: 100%;background-color:blue;"
Upvotes: 0