I need my application to run in IE9 document standard and I cannot figure out why it automatically renders in IE8 document standard.
I'm using JSF 2.1.17 and Primefaces 3.4, running in Glassfish 3.1.2. My IDE is Netbeans-7.1.2. When I open the developer tools in IE, under the "HTML" tab it shows:
<--!DOCTYPE html-->
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
However, under the "Script" tab it shows:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML lang=en xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<HEAD>
<META content="IE=8.0000" http-equiv="X-UA-Compatible">
I have looked through all my pages and templates and NO WHERE can I find the meta content="IE=8.0000" or the !DOCTYPE that is shown above. It is very odd.
All my pages have:
<!DOCTYPE html>
My main template has this:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
Other pages have:
<!DOCTYPE html>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
template="/layout/someFile.xhtml" >
Here are the things I have tried:
1) Updated the Glassfish JSF to 2.1.17, since I read that there was a bug with older versions of Mojarra that caused it to ignore the DOCTYPE.
2) I added:
<meta http-equiv="X-UA-Compatible" content="IE=9" >
to every page, hoping it would enforce IE9, but this did not work.
3) I then tried using content="IE=Edge", still no changes.
4) I changed my DOCTYPE to:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
unsure if XHTML needed this strict DOCTYPE to render properly. But this did not work.
Any help would be great. I have done a lot of research trying to sort this out, however I am new to web development, so I my understanding is quite limited.
I added:
<meta http-equiv="X-UA-Compatible" content="IE=9" >
to every page, hoping it would enforce IE9, but this did not work.
According to the MSDN document on this meta tag,
The X-UA-Compatible header isn't case sensitive; however, it must appear in the header of the webpage (the HEAD section) before all other elements except for the title element and other meta elements.
this must appear before all other elements expect for <title> and other <meta> elements. If you investigate the JSF/PrimeFaces-generated HTML closely, you'll see that there's a PrimeFaces specific <link> element before that which would block the X-UA-Compatible header from doing its job.
PrimeFaces supports several facets for the <h:head> so that you can control the ordering of the head resources. The following should do it for you:
<f:facet name="first">
<meta http-equiv="X-UA-Compatible" content="IE=9" />
</f:facet>
Again, this is specific to PrimeFaces, not to standard JSF.
Related
My adminPanel.xhtml
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:c="http://java.sun.com/jsp/jstl/core">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<title>Insert title here</title>
</head>
<body>
<c:redirect url="http://www.google.com"></c:redirect>
</body>
</html>
When I run above code, I get:
HTTP Status 500 - /loggedIn.xhtml #12,44 Tag Library
supports namespace: http://java.sun.com/jsp/jstl/core, but no tag was
defined for name: redirect
<c:redirect> tag is not available in the Facets 2.0 . For list of available or supported tags . see Tag Library Documentation Generator. You can make use of jsf page navigation to redirect.
Similar thread :
Explicit url redirect in JSF 2.0
Also tutorials:
jsf page-forward Vs page-redirect
jsf-2 Redirect
I read somewhere that the Facelet Tag Libraries URI's changed from http://java.sun.com/jsf/* to http://xmlns.jcp.org/jsf/*, so that means the new namespaces applies only for the new specification(JSF 2.2) or they can or should be used in older versions like 2.0, 2.1 or 1.x?
for example:
Library Old URI New URI
Composite Components http://java.sun.com/jsf/composite http://xmlns.jcp.org/jsf/composite
Faces Core http://java.sun.com/jsf/core http://xmlns.jcp.org/jsf/core
HTML_BASIC http://java.sun.com/jsf/html http://xmlns.jcp.org/jsf/html
JSTL Core http://java.sun.com/jsp/jstl/core http://xmlns.jcp.org/jsp/jstl/core
Facelets Templating http://java.sun.com/jsf/facelets http://xmlns.jcp.org/jsf/facelets
EDIT
To make the question more understandable nothing like a snippet of code:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:h="http://xmlns.jcp.org/jsf/html">
<h:head>
<title>test</title>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
<link rel="stylesheet" type="text/css" title="Style" href="theme/stylesheet.css" />
</h:head>
<h:body>
<h:form id="form1" styleClass="form">
<h:inputText id="text1" styleClass="inputText"></h:inputText>
</h:form>
</h:body>
</html>
The previous code would be valid for JSF 2.0? notice the taglibs:
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:h="http://xmlns.jcp.org/jsf/html"
Thanks.
From what I've seen here : http://www.oracle.com/webfolder/technetwork/jsc/xml/ns/index.html, the canonical names for the large majority of taglibs stays http://java.sun.com/
However, as stated, you can use the new URIs since they created an alias.
This is my first application with eclipse and jsf and i having some problems.
Here is my project structure:
eclipse project structure
I have downloaded and used JSF 2.1 (Mojarra 2.1.6-FCS) jar file and there is only a single jar file in that and i have used that jar file as a user library.
Now the problem i am facing is that when i use h:head in my index.xhtml file it shows that h:head is an unkown tag.Of course i am using anugular brackets. besides h:head , i am not able to type that in here.
here is my index.xhtml file:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Insert title here</title>
</h:head>
<body>
</body>
</html>
What is wrong here? IS there only one jar file file to be included?
also there are some white packages marks in the jar file i included...here they are:
while package in jar
what does it mean?
The problem is that you haven't defined the h prefix anywhere in your file. If you follow a JSF 2 tutorial, you will note this in the <html> tag definition (this one is taken from StackOverflow JSF wiki):
<html lang="en"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html">
Where
h for JSF HTML tags like <h:head>, <h:body>, <h:inputText>, etc.
f is the prefix for JSF core like <f:view>, <f:selectItems>, <f:ajax>, etc.
I have searched all around for an answer, and tried many things, but no luck. When I use MyFaces 2.1 with Eclipse Juno, and attempt to create an HTML5 page, I get
<!DOCTYTPE html >
Notice the space after the "html". When this page is viewed in FireFox, using HTML Tidy, it throws an error saying its an invalid doctype.
The source xhtml file contains with no space. Does anyone have a solution?
Thanks
Dan
I can reproduce it in at least MyFaces 2.1.9 and 2.1.10 (didn't tried older versions). This problem doesn't manifest in Mojarra. It's undoubtedly a bug in MyFaces. I recommend to report it to MyFaces guys.
For the meantime until they get it fixed, I found a workaround. Replace <!DOCTYPE>
<!DOCTYPE html>
<html lang="en"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
>
...
</html>
by <h:doctype>
<ui:composition
xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
>
<h:doctype rootElement="html" />
<html lang="en">
...
</html>
</ui:composition>
Its renderer generates the proper space-less doctype.
This problem is in no way related to Eclipse. It's just a tool like Notepad.
i am using iceFaces 2.0.2
here's what i did:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:pretty="http://ocpsoft.com/prettyfaces"
xmlns:ice="http://www.icesoft.com/icefaces/component">
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1"></meta>
<link href="./xmlhttp/css/xp/xp.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<ui:composition>
<h1>
<h:outputText value="my application" />
</h1>
<pretty:link mappingId="link">
some link
</pretty:link>
<ice:menuBar id="menuBar" orientation="Horizontal">
<ice:menuItem value="menuItem"></ice:menuItem>
<ice:menuItem value="menuItem2"></ice:menuItem>
</ice:menuBar>
</ui:composition>
</body>
</html>
above is a header file made with facelets, and the menu items appears vertically, please advise why the horizontal orientation doesn't work ?
Horizontal orientation is default, so you dont have to specify that explicitly.
Also try defining that in lower case, if you must define that.
Please make sure you have the correct CSS that is being used by it.
it was my mistake by giving the menubar a css class that was affecting the positioning.
You have to test your page on google chrome, the orientation will Work. I'm having the same issue with FireFox and IE, but not with google chrome. May be it's an icefaces bug.