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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With