3

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.

mlohbihler
  • 717
  • 1
  • 7
  • 15
  • For people who have just answered : The OP is not looking for an Editor for JS/HTML standalone files rather the need is for a JSP Editor that handles Javascript content inside a jsp file properly. – Ashutosh Jindal Aug 21 '12 at 13:58
  • +1 good question. I'd like this too. – Damo Jan 28 '13 at 09:46
  • This question seems like a duplicate from: http://stackoverflow.com/questions/211841/is-there-a-good-jsp-editor-for-eclipse Try this link out. – xivo Aug 21 '12 at 13:49

4 Answers4

1

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>
Esteban Santini
  • 465
  • 1
  • 4
  • 11
0

It might not be possible to get specific content (Javascript) inside a JSP to get syntax colored. Check this : How to activate syntax coloring for javascript in JSP editor - Eclipse

Also, this might be useful : Is there a good JSP editor for Eclipse?

The Amateras Editor in the answer above is available here: http://sourceforge.jp/projects/amateras/downloads/51002/tk.eclipse.plugin.htmleditor_2.1.0.jar and must be downloaded and manually installed to the plugins folder.

I just tried it on Indigo SR2 and it contributes an Editor for JSP Files. I do not have a sufficiently complex JSP file to test it out, but from the code that I tested it on, the syntax coloring doesn't seem to be wildly different from the 'JSP Editor' contribute by Eclipse Web Tools Platform.

Snapshots enter image description here

See the above snapshot in it's full size here : https://i.stack.imgur.com/es0OJ.png

Community
  • 1
  • 1
Ashutosh Jindal
  • 18,501
  • 4
  • 62
  • 91
  • Thanks Ashutosh. The Eclipse forum link is a couple years old now, but in the absence of any other information i guess it's a no-can-do. Workaround for now is to temporarily ctrl+shift+C the script tags, which causes the sections to format as desired. – mlohbihler Aug 21 '12 at 14:12
0

You need a plugin for Eclipse. Such as this one.

kapandron
  • 3,546
  • 2
  • 25
  • 38
0

Aptana Studio 3 .. Download and Install..

Select a theme. Enjoy JS

amtanay
  • 23
  • 5