Reputation: 61
I am using Spring MVC 3.1.x with Tiles 2.2.2 (bootstrapped project with Roo) and trying to create a view with a tiles template like:
<html xmlns:jsp="http://java.sun.com/JSP/Page"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:tiles="http://tiles.apache.org/tags-tiles"
xmlns:spring="http://www.springframework.org/tags"
xmlns:util="urn:jsptagdir:/WEB-INF/tags/util" >
<jsp:output doctype-root-element="HTML" doctype-system="about:legacy-compat" />
<jsp:directive.page contentType="text/html;charset=UTF-8" />
<jsp:directive.page pageEncoding="UTF-8" />
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=8" />
<util:load-scripts />
<spring:message code="application_name" var="app_name" htmlEscape="false"/>
<title><spring:message code="welcome_h3" arguments="${app_name}" /></title>
</head>
<body>
<!--Comments -->
<!--[if IE]>
something
<![endif]-->
...
<tiles:insertAttribute name="menu" ignore="true" />
...
</body>
</html>
The Tiles attributes are working well, but neither the comments nor the conditional CSS are rendering; they just are not present in the output code.
Any ideas to render this "html comment element" code?
Upvotes: 0
Views: 1871
Reputation: 61
Solution: Jspx files and conditional comments
In summary, comments in jsp documents are ignored. The solution is:
<jsp:text><![CDATA[<!--[if lte IE 9]>]]></jsp:text>
...
<jsp:text><![CDATA[<![endif]-->]]></jsp:text>
Upvotes: 2
Reputation: 4483
Try to use jsp comments <%-- comment --%>. Hope this helps you. Cheers.
Upvotes: 1