Martin Cooper wrote:
> I am currently looking at building a large application based on servlets and
> JSP. The principles behind the Model 2 architecture are solid, and this
> seems like the right approach. However, I have some concerns, and would like
> to hear people's thoughts.
>
> The application I am building will likely comprise somewhere between 100 and
> 150 forms. The use of a single controller servlet, a la Model 2, is
> attractive because it provides a focal point for security and database
> connectivity, amongst other things. However, it raises some concern
> regarding the manageability of so many "entry points" (for lack of a better
> term).
>
> It seems that I would need some further structure to partition the
> application. I have thought about creating "zones" of functionality, but
> it's not clear (to me, at least) what the cleanest and most maintainable way
> of doing this would involve.
>
> I have been looking at the Jakarta Struts framework, and very much like the
> way that forms and actions are hooked up. However, I'm concerned that it
> won't fly for an application with so many forms as I will have.
>
> By the way, this is an intranet app, not an Internet app, and, as such,
> there will be a relatively small number of users. Scalability in number of
> users is not important to me, but scalability in number of forms is.
>
> Any thoughts would be very much appreciated.
>
Hi Martin ... glad you like Struts so far!
In what respects are you particularly concerned about scalability? I can think of
a few areas, and talk about how Struts addresses them, but it's always useful to
focus on particular issues.
A couple of areas that were considered in the initial design, or grow out of the
way that Struts is currently defined:
* The number of different forms and actions implies that there is a reasonably
large number of Java classes in the overall design (usually at least one per
form plus one per action). In the cases where Struts manages things, it
strives to use just one instance, as in the case of actions, to avoid object
creation and garbage collection overhead. You have the opportunity to do
this as well, because your ActionMapping implementations include a factory
method to "create" form bean instances.
* Large numbers of actions mean large numbers of "names" for those actions,
which the servlet container has to know about. My general recommendation
is to use a single mapping for the controller servlet -- either a path map (i.e.
"/do/*") or an extension map ("*.do"), with the "*" part replaced by the logical
names of the actions. Adding new actions requires no changes to the
web.xml file.
* All of the actions for all aspects of your application are ultimately configured
by a single "action.xml" file, which can be problematic when you have different
developers doing the different portions of the app. One way to deal with this is
to have each functional area of the app provide a portion of the ultimate
"action.xml" file -- the actions relavant to that functional area -- and assemble
them together when building the app.
* The internal mechanics of the controller servlet are available to your
actions for runtime modification. For instance, it would be relatively easy to
build an action that added a new action mapping on the fly, or changed the
name of an action class being used by a different mapipng. Thus, there is a
set of configurable things that can be changed dynamically, without having to
restart the entire application.
* We've been talking so far in the context of a single web application to handle
your entire functional needs. It may also be reasonable to look at segragating
the functionality into multiple web applications (although you'd need to keep
several things in mind at design time, like the fact that sessions do not cross
web app boundaries).
> --
> Martin Cooper
> Tumbleweed Communications
>
Craig McClanahan
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets