Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jspx files and conditional comments

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

My question is how can I put conditional commentaries for IE in jspx? They seem to be not 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]-->

Also I would like my web pages to be HTML5 compliants.

I've tried some methods but I got incompatibilty issues in IE9 (seems to not recognize header and section).

Edit:

Here is my head 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 under IE9 I don't see the links to html5shiv and my secondary css.

like image 468
Tony Avatar asked Jan 23 '12 10:01

Tony


1 Answers

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

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.

Section 6.2.2 shows an example using jsp:text and CDATA sections which could be adapted to your usecase, please try if the following code works:

<jsp:text><![CDATA[<!--[if lte IE 9]>]]></jsp:text>
...
<jsp:text><![CDATA[<![endif]-->]]></jsp:text>
like image 72
Jörn Horstmann Avatar answered Sep 19 '22 23:09

Jörn Horstmann