10

I know that IntelliJ has an option to select all the code in a JSP file, right click, and select "format". This nicely formats all HTML, CSS, scriptlets and JSTL tags in a JSP file.

Can Eclipse do this?

If not, what is the best free Eclipse plugin that does the same?

Christopher Tokar
  • 11,644
  • 9
  • 38
  • 56

3 Answers3

4

With the Web Tool Plateform plateform (on eclipse.org website), this is very simple : in the JSP editor tab, right click->source->format (or Shift+Ctrl+F)

Vinze
  • 2,549
  • 3
  • 22
  • 23
  • 1
    The formatter in the WTP usually works pretty poorly for me - and I don't think there is any way to configure it like the regular Java formatter. – matt b Oct 27 '08 at 14:53
  • 1
    yah, the formatter in WTP has broken pages on me numerous times. – Gopherkhan Feb 12 '09 at 19:59
4

I use the EclipseHTMLEditor from Project Amateras. Be sure to set "Amateras JSP Editor" as default editor for file type "*.jsp" in Window > Preferences > General > Editors > File Associations.

UPDATE: As of today, March 27th 2015, Project Amateras seems stale. However latest releases of WTP are much improved and surely worth a try. Thanks to @Vogel612 for the info.

Marcello Nuccio
  • 3,901
  • 2
  • 28
  • 28
  • There has been no maintenance (or activity) on that website since December 2012 :( – Vogel612 Mar 19 '15 at 13:18
  • @Vogel612, I'm not working with JSP anymore... Have you tried the [latest WTP](http://www.eclipse.org/webtools/)? Maybe it's much better now than how it was back in 2010. – Marcello Nuccio Mar 20 '15 at 10:33
  • Actually I have not :( I have isntalled veloeclipse instead for a proper highlighting (unfortunately no indentation mechanism... maybe I should ;) – Vogel612 Mar 20 '15 at 11:08
  • 1
    Sooo.. I have installed and tested WTP now. It seems to me that the default formatting can be slightly quirky at times, but all in all it works wonderfully. You get a whole bunch of syntax highlight and formatting options presented in a simple and clean way. I'd say it looks good :) – Vogel612 Mar 26 '15 at 22:24
1

I found this one on eclipse plugin central.

Looks like an all in one kind of formatter. I haven't tried it myself but it might be what you are looking for

NXFormat

branchgabriel
  • 4,241
  • 4
  • 34
  • 48