Confusion in designing the Web layer in a J2EE application

Hi All,

Here is my doubt regarding optimum design for the web layer in a J2EE architecture.

I'm following the mediator pattern (as it is in J2ee blue print - Pet Store application), i,e,. I'm having a mediator servlet which degates the requests to appropriate Controller classes (which are dynamically invoked using a Controller Factory). In my entire application this is the single servlet - Mediator Servlet. There is a single controller class for each subsytem of the application. All the requests get mapped to one of these controller classes.

Now people also have another thought in this regard. They think that those controller classes should be actually a set of servlets. In that case, they feel, the performance will be better as the servlets will be better managed by the servlet engine. They will take at least less time for getting loaded memory than the ordinary java classes.

Can anybody tell me which one would be the better approach or what are the relative advantages/disadvantages for both the approaches ?

Thanks in advance,

Sourav

[1109 byte] By [souravm00] at [2007-9-26 6:45:55]
# 1
Why would you make a class a servlet that is NOT by nature a servlet?
clstern at 2007-7-1 16:09:28 > top of Java-index,Other Topics,Patterns & OO Design...
# 2

I am still not sure about all the frame works that came out either. Please help me see the real benefits.

My simple architecture contains a single servlet that serves as a controller, a servlet to perform each type of request (may include a jsp and a bean if a form exist), a bean to store the entity data, and a view manager that handles the responses. This architecture provides a single-point entry through the controller and a single point exit through the view manager, which is much simplier than a single point for both entry and exit. The architecture allows me to achieve separations of presentation logic from business logic just like any other frame work. No XML files and no actions classes. Here is a picture of a login process:

controllerServlet >[formJSP/Bean],[ processServlet/memberBean] > viewManager

Notice that the middle process is not necessary if the request is a static page request.

What is wrong with this picture? Why should use more complicated framework to get same results.

ayutaya at 2007-7-1 16:09:28 > top of Java-index,Other Topics,Patterns & OO Design...