Although HTML code is embedded in Java™ Server
Pages, strive to write JSP code that is easily readable. If you require
some special XML manipulation that cannot be incorporated in the APIs,
include a separate JSP file, so that HTML tags and Java code do not become mixed together.
Use the following standards when writing JSP files:
- Tab spacing - Set the editor tab spacing to 4.
- JavaScript™ files -
Do not include any JavaScript in
the JSP file. Put all JavaScript into
a separate JS file.
- HTML tags - Type all HTML tags and attributes in lowercase letters.
- HTML attributes - Enclose all HTML element attribute values in
double quotes. Single quotes and no quotes may work, but the standard
is to use double quotes.
- HTML tables - Strictly adheres to XSD defined.
- Tags - Close all tags, whether required or not.
- Comments - Enclose all comments in the following manner: <%/*……..*/%>
Tip: When finished coding a form, open it in any visual
HTML editor to validate that the HTML is well-formed.