Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Editing text/html content in Eclipse

I'm getting more into using javascript-rendered templates by wrapping them in 'script type="text/html"' tags (in my case within a JSP). The problem is that Eclipse (Indigo) doesn't apply any formatting such as syntax colouring, indentation, suggestions, etc. Is there a way that i can tell Eclipse to treat such content as HTML?

(Edit)

Thanks to folks for the answers, but perhaps i should clarify the question. JSP editing in Eclipse works quite well - just a few nuisances here and there. Different formats within the JSP including JSP, Javascript, HTML, and scriptlets work fine. I just wondered whether there was a configuration somewhere where i could define a <script type="text/html"> section to be rendered as HTML. If the answer is no, so be it.

like image 883
mlohbihler Avatar asked Apr 14 '26 14:04

mlohbihler


1 Answers

I know I'm very late but in case someone runs into this with the same problem, like me

I didn't want to use any plugins and I finally came up with a simple workaround for our particular case of using JSP: using the JSTL command 'out'

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<c:out value=" <script id='emptyTemplate' type='text/template'> " escapeXml="false" />

    <div class="emptyTemplateDiv">
        Nothing here
    </div>

<c:out value=" </script> " escapeXml="false" ></c:out>
like image 75
Esteban Santini Avatar answered Apr 17 '26 03:04

Esteban Santini