Women in Technology

Hear us Roar



Article:
  Page Navigation in JavaServer Faces
Subject:   Is Model 2 (JSF and Struts included) really MVC?
Date:   2003-11-09 12:33:41
From:   anonymous2
The shocking answer to the subject is, apparently, no! Let me explain:


When people think of the View, they usually only consider the pages in isolation. But in fact, the View is the complete set of pages PLUS the static navigation relationships that exist between them.
These relationships are determined by the same person that determines the look & feel of each page (the Web or UI designer).
Dynamic navigation relationships can also exist, and are determined by the outcome of operations in the Model. The UI designer cannot specify in the View such relationships, so they are managed by the Controller.


Now, in Model 2, all page navigation relationships, including the static ones, are determined by the Controller; the View, and whoever writes the .jsp files, is not allowed to directly specify them.


In the simple and conditional page navigation examples in the article, the specification of flow required the use of a separate XML configuration file. In true MVC, such navigation would have been specified in the .jsp files themselves, even in the conditional case.


For example, login.jsp should specify (in a JSP custom tag) that welcome.jsp is the next page, in the normal flow of the application. In the case of failure, the next page should also be specified in login.jsp, either explicitelly by a JSP directive (say, <%@ page errorPage="loginFailed.jsp" %>), or implicitelly by the use of one or more JSP custom tags responsible for displaying the appropriate error messages.


I hope this makes it clear. And just imagine how much simpler and easy it would be to do things this way.



Rogerio