Servlet Design

(Discussion moved to WhatMakesServletsDifferent)

My opinions is that servlets encourage a ModelViewController approach to development. You can't help generating a view (HTML returned to the browser), you are likely working from a back-end model (database, etc.), and it therefore makes sense to view your servlet as a controller--or at least part of it.

I use JavaServlets as the MvcController?, JavaBeans or EnterpriseJavaBeans as the MvcModel and JavaServerPages as the MvcView?. This lets me use the servlet to instantiate and populate a couple of beans, add them to the Request as attributes, and use getRequestDispatcher to return a JSP which uses the beans to build its content.--AlanFrancis

WebMacro [http://www.webmacro.org] is a servlet framework which I wrote, and implements a ModelViewController architecture.

You can also read my article on servlet design, which discusses this kind of approach in great detail: Fundamentals of Servlet Design [http://www.webmacro.org/FundamentalsOfServletDesign].


ServletDesign is a topic that's also occupying a lot of my time. For anyone who's interested, here are a couple of URL's pointing to material that I've written on this:

http://hometown.aol.com/kgb1001001/Articles/Simple/simple.htm

http://hometown.aol.com/kgb1001001/Articles/Serious/serious.htm

The first explains more about the Servlet API, while the second talks about the issue of preserving servlet state. I used to think that the second one was a bit dated since the introduction of the 2.0 version of the JSDK, but lately I've started to work with clients where ServerAffinity is an issue, and found out that the Hidden-field strategy is still useful.

I've also got an article on the subject out in the June 1999 issue of the JavaReport, that goes into more detail about the MVC concepts mentioned above. That's the first article of a multipart series; we're working on more.

KyleBrown


JavaServerFoundationClasses can be described as a Swing-look-alike API for WebApplicationDesign. At JSFC's core is my belief that good ObjectOrientedProgramming practices, including DesignPatterns (including ModelViewController), are applicable to WebApplicationDesign. I was inspired to start it, in part, by the JavaPro? article "Reusable UI Components for HTML" [http://www.devx.com/upload/free/features/javapro/1999/04apr99/ds0499/ds0499.asp] by Daniel R. Somerfield.-- TimTaylor ("ToolMan")


Very different article styles here. Kyle's article shows me how to actually write a servlet immediately. After reading Justin's, I still haven't seen the code for even one servlet. Justin provides a number of principles, which sound good. Kyle gives little guidance, but gets me on the road immediately.


I suspect that good ServletDesign is the same as good WebApplicationDesign.


See the AtgDynamo pages for information on Droplets.


This is odd--I was FixingLinks on this page, and I found that one of the numbered URLs that appeared in the links page isn't actually referred to in the text of the page. Anybody know what this was a link to originally?

[3] http://jsfc.sourceforge.net/


EditText of this page (last edited May 5, 2004) or FindPage with title or text search