Reputation: 4098
When editing JSPs in Eclipse, the contents of <script>
tags - i.e. Javascript code - is properly color coded and formated.
For reasons that go beyond the scope of this question, I have created a custom javascript tag, let's call it <sj:script>
. The body of this type is pure javascript as you would have in a regular <script>
tag.
However, when I have Javascript code within my custom tag, it is treated as simple text (no color coding, no proper indentation, etc).
My question is, how do I make Eclipse use a specific editor within custom JSP tags?
Upvotes: 6
Views: 6111
Reputation: 328536
You can try MyEclipse or Aptana Studio. They offer much better editors for web development.
But a much better approach is to put the JS into a different file and reference that with <script src="...">
:
[EDIT] Eclipse is open source. Download the code for the WTP project, look for the text editor parts and search for "script". In all places that you find, add "sj:script", too.
Upvotes: 1
Reputation: 1573
Eclipse has a template feature where in you can add specific tag ,which can be made available for all JSP pages.
Ensure you have installed Eclipse WTP ( Web Tools Platform )
1.Open Preferences window [ Select Window > Preferences ] 2.Expand Web Option from the menu, upon which you can see [ CSS Files,HTML Files etc.. 3.Select JSP Files 4.Select Editor 5.Select Templates 6.In the corresponding pane , click New and from there rest can be easily done.
Upvotes: 0
Reputation: 22603
AFAIK, editors are chosen based on file extension, and there's no mechanism to customize this based on particular content inside the file.
I see 2 options
Put your javascript snippet in an external file, use the include directive inside your custom script tag.
<%@ include file="javascript.js" %>
Upvotes: 0
Reputation: 41040
I have a list of plugins for eclipse which enable eclipse to edit JS files:
http://www.delicious.com/powtac/javascript+eclipse
Just go trough the links and see the different descriptions how to install them.
Upvotes: 0
Reputation: 1208
Have you included the Tag Library Descriptor file in the jsp where you are using the custom tag?
Upvotes: 0