Develop > Presentation layer > Work with JSP pages > WebSphere Commerce JSP programming best practices
JSP programming best practice: Ensure XHTML-compliance
JSTL and HTML elements of the JSP pages should conform to the W3C XHTML standard and recommendations.
- Use lowercase for all element and attribute names. For example, <table>, and not <TABLE>.
- Enclose all attribute values in double quotation marks. For example, <img value="car.jpg" width="20" />, and not <img value='car.jpg' width=20/>.
- Ensure that every element has an end tag or is self-terminating if it is empty. For example, <p>Welcome to WebSphere Commerce!</p> or <c:set var="xyz" value="uvw" />.
- For HTML-compatibility, include a space in all empty element tags before closing the tag. For example, <br /> instead of <br/>.
Verify the HTML page that the JSP page produces begins with a valid document type declaration. For example:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
To ensure XHTML-compliance, use XHTML validators, such as the WebSphere Commerce Developer HTML validator (right-click on the file and select Run Validation) or the W3C Markup Validation Service.
Related reference
WebSphere Commerce JSP programming best practices