Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

New line after every tag in eclipse when editing jsp files

When auto-formatting JSP files in Eclipse using Ctrl+Shift+F, it is trying to fit as many tags on a line as possible and then the tag that doesn't fit it will break and place the attributes on the next line.

This is created very messy code, example below.

        <div class="type-text"><label for="echo">Project Name: </label> <s:textfield
            id="projectName"
            name="projectName"
            value="Project Name"
        >
        </s:textfield></div>

Does anyone know how to format JSP files better?

like image 932
vaughan Avatar asked Oct 15 '22 10:10

vaughan


1 Answers

Hard, but true: just don't use it. Eclipse is great with Java(EE), but weak with (X)HTML/JSP in general. IntelliJ is better here. In Eclipse you just have to already write nice intented (X)HTML/JSP code. You can however configure several parameters in preferences by Web > HTML files > Editor, such as the Line Width. But still, it doesn't indent code nicely.

like image 188
BalusC Avatar answered Oct 19 '22 02:10

BalusC