Web tier Architecture:

Abstract: Handling "page logic tier" - scriptlets not so bad; struts needs "page" tier.

Is seems to me that the MVC model 2 architecture fails to address an additional stage 
of "logic". Beyond the business logic, there is really a whole additional tier - the 
"page layout logic tier"- and this tier is often more complex and problematic than the 
buisness logic tier.

The issue is dealing with a system that may have 100 different pages, all not too 
different from each other. When can the same jsp be used to render mutlitple pages 
using page logic, and when should a page, or set of pages be rendered with a whole new 
jsp?

In our applications, there are hundreds of pages that are often only slightly 
different - and the requrements are simply unknown and unknowable. As we go online, 
the users begin experimenting with the system, and come up with new ideas and 
requirements. As we complete a part, the requirements for the next part of the system 
are changed. So we need an approach that is stable and flexible.

Personally, I think it is a much bigger SIN to put business logic in a tag library, 
than it is to use scriptlets in a jsp page to handle page logic - especially since the 
current architectual ideas ( MVC model 2 and the framework Struts ) seem to completely 
ignore the "page logic" tier.

The problem with the page logic tier becomes much more problematic with a site using 
frames. For non-frame based control flow, the output from the action class is inserted 
into the request object, and forwarded to the jsp - so the data elements are 
encapsulated and short lived - after the jsp uses the data in the request object, the 
request object expires.

However, with a frames based site, the output of the action class must be inserted 
into the session object, and then the forward is to a framset which is downloaded to 
the browser. Each frame then fectches its own jsp page from the server. So, the data 
response to the initial http request is inserted into the session object, and if the 
connection breaks to the browser, maybe never used - and left dangling around in the 
session object.

The struts framework has a tier for processing the data input (action forms) that 
includes a data object ( the form bean) and two default methods, reset() and 
validate(). The struts frameworks has a tier for handling the business logic - the 
Action class which can handle the businees logic, calling other ordinary java classes 
for help. But, once the data has been built, there is nothing in the struts framework 
for organizing the output. I've started to use a "page" tier.

With a website that uses frames, and where the back button is expected to work, and 
where the user may open multilple browser windows during the session, this can be a 
mess. The business logic output from multiple action classes, and to support multiple 
framset and the consequent jsp fetches, all become a jumbled mess in the session 
object.

Thanks,

  James

 

Reply via email to