[JAVA] Settings to be made when HTML or JSP is formatted in Eclipse and the layout is disappointing

If you implement JSP or HTML in Eclipse and format it, it will be a shame. Specifically, if you can write the format in such source code, it will be as follows.

[Before formatting] before.png

[After formatting] after.png

For the source, I borrowed the sample of Spring Boot that I am using now and modified it a little. https://github.com/spring-projects/spring-boot/tree/master/spring-boot-samples

What's unfortunate about this format is that it doesn't take into account two things:

  1. Unnecessary line breaks are inserted in long sentences
  2. Some HTML tags do not break

after_red.png

Therefore, if you make the following settings in Eclipse, the required format will be created.

  1. Click "Windows"-> "Preferences" from the menu
  2. When the "Preferences" screen opens, select "Web"-> "HTML Files"-> "Edtor".
  3. Change "Line width:" of "Formatting" from "72" to "200"
  4. Select the HTML tag you want to start a new line from "Inline Elements:" on the same setting screen and press "Remove" to remove it.

"Line width:" is the setting for the number of characters to be displayed on one line. 200 characters is just a guide, so if you want to display a longer sentence on one line, adjust it appropriately.

HTML tags to be displayed in inlie are registered in "Inline Elements:". Therefore, tags deleted from this setting will be displayed with line breaks.

Now it feels good to format it again.

Recommended Posts

Settings to be made when HTML or JSP is formatted in Eclipse and the layout is disappointing
Check points when Windows and Ubuntu shared folder settings are not successful in VirtualBox
Settings to be made when HTML or JSP is formatted in Eclipse and the layout is disappointing
I made a Restful server and client in Spring.
I installed CentOS 8 on Windows 10 using VirtualBox and Vagrant
A memorandum when installing Docker and building a Linux container
"ClassNotFoundException" is displayed when tomcat is started in eclipse and cannot be started
[jOOQ] How to CASE WHEN in the WHERE / AND / OR clause
When the project is not displayed in eclipse
Be absolutely careful when putting the result of and / or in a variable!
When the hover of Eclipse is hard to see
What to do when "Fail to load the JNI shared library" is displayed in Eclipse
How to solve the problem when the value is not sent when the form is disabled in rails and sent
Throw an exception and catch when there is no handler corresponding to the path in spring
How to output the value when there is an array in the array
How to write the view when Vue is introduced in Rails?
The first thing to do when you want to be happy with Heroku on GitHub with Eclipse in Java
Pg_resetwal can be used to start the PostgreSQL Docker container when WAL is broken and cannot be started.
I summarized the points to note when using resources and resources in combination
What to do if the prefix c is not bound in JSP
What to do if tomcat process remains when tomcat is stopped in eclipse
[Ruby] How to prevent errors when nil is included in the operation
Is it possible to put the library (aar) in the Android library (aar) and use it?
How to set tabs and spaces to be visible by using the tab key to insert spaces in Java files in Eclipse
When reassigning to an argument in a Ruby method and then calling `super` → The reassigned one is used
How to set when "The constructor Empty () is not visible" occurs in junit
Be careful with requests and responses when using the Serverless Framework in Java