Struts 2 Coding Conventions
Skip to end of metadata
Go to start of metadata

The Struts 2 development community prefers code following a few conventions listed here. Please respect them, if you want to contribute to the project.

Sun/Oracle Coding Conventions

In general the Struts 2 project follows the official Java Code Conventions:

http://www.oracle.com/technetwork/java/codeconvtoc-136057.html

Spaces, no tabs

Generally there is nothing wrong with having tabs, except that there is a historic agreement that we want to favor space character over tabs for the Struts codebase. The official Java Code Conventions leaves it open whether to use tab or space characters. The WebWork project, which was merged into the Struts project as the base for Struts 2, already had a "no tab character" convention.

Another reasons is that commit messages are generally more readable with spaces.

Modern IDEs can support the code style with just a tick.

  • As for IDEA eg. you can create profiles if your daily coding convention differs from the project's.
  • In Eclipse, please open "Properties", then go to Java Code Style and Formatter. Enable project specific settings and choose the tab policy "Spaces".
Labels
  • No labels