jsp 中的元标记与 a4j
我在 JSF 应用程序中有一个使用 A4J 的 JSP 页面。我想添加一个元标记以将 IE9 置于兼容模式。不幸的是,这个元标签必须是头部的第一个标签。
A4J 自动在头部添加一些标签来加载其样式表和 javascript。它被添加在 IE9 元标记之前。
我搜索了 A4J 的文档,但找不到有关如何控制这些标签的任何信息。
有谁知道如何在 A4J 标签之前插入 IE9 元标签?
这是我的 JSP 页面的第一部分:
<?xml version="1.0" encoding="utf-8"?>
<html xml:lang="nl" xmlns="http://www.w3.org/1999/xhtml"
xmlns:jsp="http://java.sun.com/JSP/Page"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:tsi="http://components.traserv.com/jsf"
xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
xmlns:t="http://myfaces.apache.org/tomahawk">
<jsp:output doctype-public="-//W3C//DTD XHTML 1.1//EN"
doctype-root-element="html"
doctype-system="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"
omit-xml-declaration="false" />
<head>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />
...
这是输出:
<?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" xml:lang="nl">
<head>
<link class="component" href="/a4j/s/3_3_0.GAorg/richfaces/renderkit/html/css/basic_classes.xcss/DATB/eAELXT5DOhSIAQ!sA18_.f" rel="stylesheet" type="text/css" />
<link class="component" href="/a4j/s/3_3_0.GAorg/richfaces/renderkit/html/css/extended_classes.xcss/DATB/eAELXT5DOhSIAQ!sA18_.f" media="rich-extended-skinning" rel="stylesheet" type="text/css" />
<script src="/a4j/g/3_3_0.GAorg.ajax4jsf.javascript.AjaxScript.f" type="text/javascript"></script>
<script type="text/javascript">window.RICH_FACES_EXTENDED_SKINNING_ON=true;</script>
<script src="/a4j/g/3_3_0.GAorg/richfaces/renderkit/html/scripts/skinning.js.f" type="text/javascript"></script>
<meta content="IE=EmulateIE8" http-equiv="X-UA-Compatible"/>
<title></title>
....
I have a JSP page in a JSF application which uses A4J. I want to add a meta tag to put IE9 in compatibility mode. Unfortunately, this meta tag has to be the first tag in the head.
A4J automatically adds some tags to the head to load its stylesheets and javascript. This gets added before the IE9 meta tag.
I've searched the documentation for A4J, but couldn't find anything about how to control these tags.
Does anybody know how i can insert the IE9 meta tag before the A4J tags?
Here is the first part of my JSP page:
<?xml version="1.0" encoding="utf-8"?>
<html xml:lang="nl" xmlns="http://www.w3.org/1999/xhtml"
xmlns:jsp="http://java.sun.com/JSP/Page"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:tsi="http://components.traserv.com/jsf"
xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
xmlns:t="http://myfaces.apache.org/tomahawk">
<jsp:output doctype-public="-//W3C//DTD XHTML 1.1//EN"
doctype-root-element="html"
doctype-system="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"
omit-xml-declaration="false" />
<head>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />
...
And here is the output:
<?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" xml:lang="nl">
<head>
<link class="component" href="/a4j/s/3_3_0.GAorg/richfaces/renderkit/html/css/basic_classes.xcss/DATB/eAELXT5DOhSIAQ!sA18_.f" rel="stylesheet" type="text/css" />
<link class="component" href="/a4j/s/3_3_0.GAorg/richfaces/renderkit/html/css/extended_classes.xcss/DATB/eAELXT5DOhSIAQ!sA18_.f" media="rich-extended-skinning" rel="stylesheet" type="text/css" />
<script src="/a4j/g/3_3_0.GAorg.ajax4jsf.javascript.AjaxScript.f" type="text/javascript"></script>
<script type="text/javascript">window.RICH_FACES_EXTENDED_SKINNING_ON=true;</script>
<script src="/a4j/g/3_3_0.GAorg/richfaces/renderkit/html/scripts/skinning.js.f" type="text/javascript"></script>
<meta content="IE=EmulateIE8" http-equiv="X-UA-Compatible"/>
<title></title>
....
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以将 X-UA-Compatible 设置为 HTTP 标头,而不是将其作为元标记包含在页面中。这在 IE 中同样有效,事实上甚至更好。
恐怕我不知道如何在 JSF 设置中执行此操作。
You could set X-UA-Compatible as an HTTP header instead of including it in the page as a meta tag. This works just as well, better in fact, in IE.
How you do this in a JSF set up I'm afraid I don't know.