0

要するに、私はこれをやりたいと思います(条件部分、私はで含める方法を知っています<h:outputStyleSheet>):

<link rel="stylesheet" href="[path-to-dist]/leaflet.css" />
<!--[if lte IE 8]>
    <link rel="stylesheet" href="[path-to-dist]/leaflet.ie.css" />
<![endif]-->

JSF 2 で。

ありがとう!

4

4 に答える 4

1

使用する<h:outputText escape="false">

<h:outputText value="&lt;!--[if lte IE 8]&gt;&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;[path-to-dist]/leaflet.ie.css&quot;/&gt;&lt;![endif]--&gt;" escape="false" />

はい、それは醜い一線ですが、Facelets は本質的に XML ベースのビュー テクノロジであるため、他に方法はありません。


更新: JSF ユーティリティ ライブラリOmniFacesを使用している場合は、その<o:conditionalComment>コンポーネントをそのまま使用できます。

<o:conditionalComment if="lte IE 8">
    <link rel="stylesheet" href="[path-to-dist]/leaflet.ie.css" />
</o:conditionalComment>
于 2012-05-16T11:56:43.767 に答える
0

<h:outputText value="#{bean.pathToDist}" />リンクにラップできるはずだと思います。のように<link rel="stylesheet" href="<h:outputText value="#{bean.pathToDist}" />/leaflet.css" />

于 2012-05-16T07:49:11.620 に答える
-1

試してみてください:

<f:verbatim>
&lt;!--[if IE]&gt;
<link rel="stylesheet" href="path/to/file.css" />
&lt;![endif]--&gt;
</f:verbatim>
于 2012-05-16T12:01:28.847 に答える