Configure Eclipse to use the Javascript Editor

When editing JSP in Eclipse, the content of tags <script>, that is, Javascript code, is correctly encoded in color and formed.

For reasons beyond the scope of this question, I created a custom javascript tag, called it <sj:script>. The body of this type is pure javascript, as in a regular tag <script>.

However, when I have Javascript code inside my custom tag, it is treated as plain text (without color coding, without proper indentation, etc.).

My question is: how do I get Eclipse to use a custom editor in custom JSP tags?

+5
source share
5 answers

You can try MyEclipse or Aptana Studio , They offer much better editors for web development.

But it is much better to use JS in another file and refer to <script src="...">:

  • You can use the best editor.
  • The browser can cache JavaScript (rather than loading it every time with the rest of the page).
  • You can write tests for JavaScript (almost impossible when JS is held hostage in a JSP file).

[EDIT] Eclipse is open source. Download the code for the WTP project, find the parts of the text editor and find the "script". In all the places you find, also add "sj: script".

+1
source

jsp, ?

0
0

AFAIK, , .

2

  • , script (, )
  • javascript , include script.

        <%@ include file="javascript.js" %> 
    
0

Eclipse has a template function in which you can add a specific tag that may be available for all JSP pages.

Make sure you have installed Eclipse WTP (web tool platform)

1. Open the settings window [Select window> Settings] 2.Expand Web Option from the menu where you can see [CSS files, HTML files, etc. 3. Select the JSP files 4. Select the editor 5. Select the templates 6. In the corresponding panel, click "Create", and from there you can easily do it.

0
source

All Articles