0

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?

erramun
  • 61
  • 7

2 Answers2

2

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>
Community
  • 1
  • 1
erramun
  • 61
  • 7
1

Try to use jsp comments <%-- comment --%>. Hope this helps you. Cheers.

Japan Trivedi
  • 4,445
  • 2
  • 23
  • 44
  • JSP comments do not render the html content itself. My problem is that I want to render de code. – erramun Jun 12 '12 at 12:56