Tips for Views

  • Use the application's layout to specify as much repeating content as possible.
  • Stick to the general JSP best practices.
  • Use <e:message> tag along with an appropriate message bundle to obtain localized error messages form the error keys in models.

    Note: The markup used in views for this tutorial are not necessarily written in a semantic/accessible form. They are used so as to achieve the goal in the least amount of code.

The Layout


The application wide layout. Contains the navigation links to different sections of the application in this tutorial.

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
<%@taglib uri="" prefix="fmt" %>
<fmt:setBundle basename="messages" scope="application" />

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "">
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
        <title>Programming Languages Portal</title>
        <a href="${contextRoot}/Home">Home</a>
        <a href="${contextRoot}/Paradigms">Manage Paradigms</a>
        <a href="${contextRoot}/ExecutionEnvironments">Manage Execution Environments</a>
        <a href="${contextRoot}/Languages">Manage Programming Languages</a>
        <p />
        <jsp:include page="${view}" />

The Message Bundle


# Error messages for basic formats
formatError.Byte=Invalid Byte Value.
formatError.Short=Invalid Short Value.
formatError.Integer=Invalid Integer Value.
formatError.Long=Invalid Long Value.
formatError.Float=Invalid Float Value.
formatError.Double=Invalid Double Value.
formatError.BigDecimal=Invalid BigDecimal Value.
formatError.BigInteger=Invalid BigInteger Value.
formatError.Date=Invalid Date Value.

# Application specific error messages
name.required=Name is required.
description.required=Description is required.
executionEnvironment.required=Select an Execution Environment.
paradigms.required=Select at least one paradigm.
typing.required=Select at least one typing system.