By failing to prepare, you are preparing to fail.<br />Benjamin Franklin (1706 - 1790)
Originally posted by Dale DeMott:
Many people like a single servlet design where everything goes through a single servlet. Others like to cut up parts of the system by servlet. Personally if I were programming a small system, I would make the system only have 1 servlet. The servlet would then process the action performed by the user and then redirect the program flow through maybe a command factory for processing, then return back and serve up the new data to the next jsp page. Just my 2 cents worth.
Personally if I were programming a small system, I would make the system only have 1 servlet.
Originally posted by Bear Bibeault:
Small hijack:
This is called the Single Front Controller pattern and I use it for all my web apps, be they small or enterprise-sized. I think its utility increases with larger web apps.
Originally posted by Bear Bibeault:
The number of files isn't an issue that is even on my radar.
I like the SFC pattern because my front controller does a lot of work for me, before and after executing the 'action', that I would otherwise have to code in every servlet. Another pattern I've seen for such reuse is to have an abstract base servlet that contains the 'shared' code. Yet another uses servlet filters.
While these, and any other number of possible patterns, are perfectly plausible, I chose the SFC/Action pattern for my framework and it works really well for me. If I had to pick one major benefit of many I feel that I reap from this decision, it's that my Action classes are almost always just a few lines of code. (Having a strong business layer architecture helps this as well).
I'm not even going to hint that the SFC is THE pattern to use, I just think that's it's one of the possible good patterns to use that may or may not work with your style of structuring applications.
Bear write all this while rolling his eyes at me
create an abstract servlet class that all Servlet inherit.
Don't get me started about those stupid light bulbs. |