Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ JSP formatting

When I try to format some JSP files in IntelliJ, all the lines start from the beginning.

What options should I change to make IntelliJ to format JSP files prettier?

like image 483
DPM Avatar asked Jan 10 '16 21:01

DPM


People also ask

How do I beautify my code in IntelliJ?

Go to Settings/Preferences | Editor | Code Style, select your programming language, and open the Wrapping and Braces tab. In the Keep when reformatting section, select the formatting rules which you want to ignore and deselect those which should be applied. Reformat your code ( Ctrl+Alt+L ).

What are JSP files?

A JSP page is a text document that contains two types of text: static data, which can be expressed in any text-based format (such as HTML, SVG, WML, and XML), and JSP elements, which construct dynamic content. The recommended file extension for the source file of a JSP page is . jsp.

How do I run a JSP file in IntelliJ Community Edition?

3 and all you have to do is go to "Settings > Editor > File Types". Under "Recognized File Types", click on HTML, then under "Registered Patterns" add *. jsp .. Nothing else is required.


1 Answers

IntelliJ IDEA 15

JSP is related to HTML and in HTML the children of the following tags html,body,thead,tbody,tfoot are not indented by default.

This can be changed from File > Settings... > Editor > Code Style > HTML > Other > Do not indent children of: > remove everything from there > OK

Do not indent children of Remove tags

Now you can press Ctrl + Alt + L.

like image 72
ROMANIA_engineer Avatar answered Sep 20 '22 04:09

ROMANIA_engineer