jwma's Architecture - View Element
 
Main | Deployment | Configuration | Architecture | Development | Screenshots | SF Project Site
Index | Overview | Model (M) | View (V) | Controller (C) | Other Elements


Understanding the View Element

A view as a server side pattern is basically the assembler of the actual interface information which is delivered to the client on the network. Table 1 shows the actual assembly process (abstract diagram left hand, example right hand).The example snippet is from a JSP/HTML based View implementation.

<%-- Trash status information --%>
<table width="90%">
 <tr>
  <td width="100%"align="right">
   <% if (trash.isEmpty()) { %>
    <img border="0" src="images/trash_empty.png" alt="<i18n:message key="trashbin.empty"/>">
   <% } else { %>
    <a href="<%= htmlhelper.getFolderDisplayAction(trash) %>">
     <img border="0" src="images/trash_full.png" alt="<i18n:message key="trashbin.full"/>">
    </a>
   <% } %>
  </td>
 </tr>
</table>
<%-- END: Trash status information --%>
<table width="90%">
 <tr>
  <td width="100%"align="right">
        <img border="0" src="images/trash_empty.png" alt="Empty trashbin.">
      </td>
 </tr>
</table>
Table 1: From the template to the actual rendered view on the client


In the architectural documentation the term "View" thus refers to an abstract form of the template(s) and their respective technology, keeping in mind that it will represent a general description of how the finally rendered interface (i.e. view in a more standard MVC sense) should look like.

jwma's Abstract Views

As mentioned in the overview, the view element is supposed to be created and maintained by a view designer. It should be rather free of complex application logic, easy to maintain (i.e. change look & feel for example) and based on the view designer's perspective of the model (see model documentation).
To allow the view element of the architecture to be implemented using an arbitrary template technology (i.e. JSP, Velocity, WebMacro), jwma defines a set of abstract views to which a controller can redirect. These are listed in Table 2.

Abstract View (name) Description
Error A view that displays an explanation for errors that occured (when they cannot be inlined into the last view).
Login A view welcoming the user and presenting him with facilities to sign in (i.e. authenticate).
Logout A view confirming logout; saying goodbye to the user that just successfully signed out.
Folder A view displaying the contents of a folder and related information.

Message

A view displaying the contents of a message and related information.
Compose A view displaying a form to compose a mail message.
Preferences A view displaying the users preferences for system settings.
Firsttime

A view that notifies the user when signing in the first time. This view can be a hook for an arbitrary account creation procedure, per default jwma tries to authenticate the user and if successful, to create a set of user data silently.

Contacts A view displaying a users contacts and contact groups.
Contact (Display) A view displaying a stored contact and related information.
Contact Edit A view displaying a form for editing a contact and related information.
Group (Display) A view displaying a stored contact group and related information.
Group Edit A view displaying a form for editing a contact group and related information.
Table 2: List of Abstract Views

Additional views can be defined if the model instances (i.e. the data) necessary to create the presentation are available. An example (which is actually implemented in the basic view package) is a printer-friendly message view.

View Localization

As a matter of fact anything presented to the user will be provided by a view, leaving it up to the view developer's choice how to deploy i18n. Whereever possible i18n has been taken care of. More information can be found in the development documentation section, covering the basic view and the employed method for i18n.

A Standard Implementation - The Basic View

jwma is distributed with a standard view implementation based on JSP's, which is called the "basic view". This standard implementation is targeting web browsers as clients, producing HTML (v4.0 compatible, few very simple Java Scripts) and requires absolutely no Java functionality (i.e. Java Plugin) on client side. Table 3 lists the view implementations with their respective mapping to an abstract view. Table 4 lists additional JSP's (or JSP includes) included in the basic views implementation.
Abstract View Basic View Implementation
Error error.jsp
Login login.jsp
Logout logout.jsp
Folder folder.jsp

Message

message.jsp
Compose compose.jsp
Preferences preferences.jsp
Firsttime

NA

Contacts contacts.jsp
Contact (Display) contact.jsp
Contact Edit contact_edit.jsp
Group (Display) contactgroup.jsp
Group Edit contactgroup_edit.jsp
Table 3: List of Mapping Abstract Views - Basic Views

Basic View Implementation Description
index.jsp Utility page redirecting to the login view.
printmessage.jsp A view that displays a message in a printer friendly way. Demonstrates how to extend the view element of jwma's architecture with additional views (i.e. representations).
messageheader.jsp A view that displays the header of a message. Another demonstration for an additional view.
mixed_view.jsp A view part (included from folder.jsp) which is used to display folders that allow subfolders and messages at the same time.
embedded_messagelist.jsp A view part (included from folder.jsp) which is used to display messages in a folder that allows subfolders and messages at the same time.
distinct_view.jsp A view part (included from folder.jsp) which is used to display folders that do not allow subfolders and messages at the same time.
messagelist.jsp A view part (included from folder.jsp) which is used to display messages in a folder that allows only messages or subfolders.
Table 4: Additional JSP's of the Basic View


Following enumeration covers the main reasons for the choice of standard implementation:

Therefore the basic implementation (delivered with jwma, and making it a webmail package) enables a deployer to use a web design tool and adapt jwma to the required look & feel (i.e. coporate/site identity). It also might be a good base for implementing a view targeting WAP clients.

© 2000-2003 jwma team