Jspx Files and Conditional Comments

I would like to create a web application using Spring and .jspx web pages.

My question is, how can I add conditional comments for IE in jspx? They do not seem to be interpreted.

<!--[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]-->

In addition, I would like my webpages to be HTML5 standards.

I tried some methods, but I had problems with incompatibility in IE9 (it seems that they do not recognize the header and section).

Edit:

Here is my main tag

<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]-->

But, if I look at the source in IE9, I do not see the link to html5shiv and my secondary css.

+5
source share
4 answers

According to the JSP 2.0 specification, section 1.5.2, comments in jsp documents are ignored:

Comments in JSP docs use XML syntax as follows:

<!-- comments ... ->

. JSP "" JSP.

6.2.2 jsp:text CDATA, , , :

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

, ASCII .jspx. :

&lt;&#33;&#45;&#45;[if IE]>

    <link rel="stylesheet" type="text/css" href="css/screenIE.css" />

&lt;&#33;[endif]-->
+3

HTML 5 htmlshiv . , . jstl.

    <head>
    //Other imports
    <!--[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]-->
    </head>
0

, HTML, , jstl , :

<!--[if IE 9]&gt;&lt;div id=&quot;ie-9&quot;&gt;&lt;![endif]-->

So, Abhi, you need to say jstl to leave the conditional part alone, tell her not to parse it. Jstl will not ignore it, simply because you put it in.

0
source

All Articles