gpt4 book ai didi

java - Jspx 文件和条件注释

转载 作者:太空狗 更新时间:2023-10-29 15:36:12 26 4
gpt4 key购买 nike

我想使用 Spring 和 .jspx 网页创建一个 Web 应用程序。

我的问题是如何在 jspx 中放置 IE 的条件注释?它们似乎没有被解释。

<!--[if lt IE 9]>
<link rel="stylesheet" type="text/css" href="css/style.css" />
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->

此外,我希望我的网页符合 HTML5 标准。

我已经尝试了一些方法,但我在 IE9 中遇到了不兼容问题(似乎无法识别标题和部分)。

编辑:

这是我的头像

<meta content="text/html" charset="UTF-8" http-equiv="content-type" />
<link rel="stylesheet" type="text/css" href="css/style.css" />
<!--[if lte IE 9]>
<link rel="stylesheet" type="text/css" href="css/style_IE8.css" />
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->

但是,如果我在 IE9 下查看源代码,我看不到 html5shiv 和我的辅助 css 的链接。

最佳答案

根据JSP 2.0规范,1.5.2节,jsp文档中的注释被忽略:

Comments in JSP documents use the XML syntax, as follows:

<!-- comments ... ->

The body of the content is ignored completely. Comments in JSP documents may be used for documentation purposes and for “commenting out” portions of a JSP page.

第 6.2.2 节显示了使用 jsp:text 的示例和 CDATA 部分可以适应您的用例,请尝试以下代码是否有效:

<jsp:text><![CDATA[<!--[if lte IE 9]>]]></jsp:text>
...
<jsp:text><![CDATA[<![endif]-->]]></jsp:text>

关于java - Jspx 文件和条件注释,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8969854/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com