JSF 2.1及更高版本IE条件注释

编程入门 行业动态 更新时间:2024-10-12 03:17:10
本文介绍了JSF 2.1及更高版本IE条件注释的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我注意到在JSF 2.1.*中,我的IE条件注释不再起作用. HTML实体&替换了各种字符.使注释语法无效. BalusC指出了另一个问题中的解决方案使用h:outputText.我的问题是,我希望在第一个元素周围的页面顶部显示条件注释.这意味着我不能使用h:outputText,因为我还没有定义它的命名空间.我相信这是正确的.这是一个代码示例.

I've noticed that in JSF 2.1.* my IE conditional comments are no longer working. Various characters are being replaced by HTML entities & invalidating the comment syntax. BalusC has pointed out a solution to the problem in another question which uses h:outputText. My problem is that I want my conditional comments at the top of my page, around the first element. This means that I can't use h:outputText as I haven't defined it's namespace yet. I believe that's correct anyway. Here's a code example.

当今大多数JSF页面将从类似于HTML5 Boilerplate语法的模板开始:

Most by JSF pages nowadays will start off 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="www.w3/1999/xhtml" xmlns:ui="java.sun/jsf/facelets" xmlns:h="java.sun/jsf/html" xmlns:f="java.sun/jsf/core" xmlns:c="java.sun/jsp/jstl/core" lang="en"><!--<![endif]--> <h:head> <meta charset="utf-8" /> ...

使用BalusC提到的解决方案,我希望在第2行上输入<h:outputText />,但尚未定义h名称空间.是我可以使用的元素,可以将各种名称空间附加到该元素,但不会影响最终的HTML吗?还有其他想法可以解决这个问题吗?

With BalusC's mentioned solution, I'd want <h:outputText /> on line 2 but the h namespace isn't defined yet. Is that an element I can use that I can attach the various namespaces to but won't affect my final HTML? Any other ideas how I can get round this issue?

推荐答案

将其全部包装在<f:view>中,并在其中定义名称空间.

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

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

否则,整个JSF视图已经隐式包装在<f:view>中.

The entire JSF view is otherwise already implicitly wrapped in a <f:view>.

更多推荐

JSF 2.1及更高版本IE条件注释

本文发布于:2023-11-27 01:33:38,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1636029.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:更高   注释   条件   版本   JSF

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!