Roger Kjensrud wrote:

> Hello,
>
> I've just started to take a look at the framework, and I like what I see!!!
> Going through the user guide and some of the code(v0.5), I've a couple of
> questions:
>
> 1. It seems that in general the Vector and Hashtable classes are used. Are
> there any particular reason why these are used as supposed to the
> corresponding ArrayList and Hashmap? Will I run into synchronization issues
> if I replace with the unsynchronized ones?
>

At the time Struts 0.5 was released, the consensus of the community was that we
still needed to run on JDK 1.1 platforms.  Since then, the community consensus
has shifted, and Struts 1.0 (to be released very soon -- I would recommend you
do any new development based on a recent nightly snapshot rather than Struts
0.5) requires Java2.  Previous uses of Vector and Hashtable have generally been
migrated to ArrayList and HashMap.

In general, using the unsynchronized collection classes in a servlet based
application requires you to be aware of whether it is possible to access that
collection from multiple threads at the same time or not.  If not (for example,
a local variable inside a method that is never passed to external code), it is
safe to code without synchronizing.  So, there is no general answer to this
question -- you have to look at each situation individually.

>
> 2. In the Internationalized Messages section of the user guide it talks
> about "the resource bundle for the application". I was thinking of using
> several smaller resource bundles for the application, for example one for
> each view. What is the best way(if possible) to acheive this within this
> framework.
>

The current MessageResources implementation assumes that there is only one
bundle for the entire app -- primarily for simplicity (because the message tag
knows where to look for it, and you don't have to tell it every time).
Alternatives:

* Manually load your own MessageBundle implementations as servlet
  context attributes, and then use the "bundle" attribute of the message
  bean on every call to tell which bundle to use.

* Maintain the different bundle files separately in your source code
  directories, but have a script as part of your build procedure that
  combines them into the single bundle that Struts expects.

>
> Thanks,
>
> Roger Kjensrud

Craig McClanahan


Reply via email to