JSF 2.1 and IE Conditional Comments

I noticed that in JSF 2.1. my conditional IE comments no longer work. Different characters are replaced with HTML objects and invalid comment syntax. BalusC pointed out a solution to the problem in another question that uses h: outputText. My problem is that I want my conditional comments to be at the top of my page, around the first element. This means that I cannot use h: outputText, since I have not defined its namespace yet. In any case, I believe. Here is a sample code.

In most cases, JSF pages start with a template similar to the HTML5 Boilerplate syntax:

<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7 my-application" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8 my-application" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9 my-application" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js my-application" xmlns="http://www.w3.org/1999/xhtml"
  xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html"
  xmlns:f="http://java.sun.com/jsf/core" xmlns:c="http://java.sun.com/jsp/jstl/core" lang="en"><!--<![endif]-->
<h:head>
  <meta charset="utf-8" />
  ...

With the mentioned BalusC solution, I would like <h:outputText />in line 2, but the namespace h is not yet defined. Is this an element that I can use so that I can attach different namespaces, but will not affect my final HTML? Any other ideas how I can get around this problem?

Lee

+5
source share
1 answer

Wrap it all in <f:view>and define namespaces there.

<!DOCTYPE html>
<f:view xmlns="http://www.w3.org/1999/xhtml" ...>
    ...
</f:view>

The whole kind of JSF is otherwise already implicitly wrapped in <f:view>.

+8
source

All Articles