Last time I checked (which was a couple of months back), Struts uses the static methods of BeanUtils. This means that they just use the same instance used by all classes for the same application. The same goes for ConvertUtils.register(). So, from what I understand, once you register a converter, that converter becomes active for all BeanUtils calls from that point on, not only for the method that registered the converter, but also for other threads which may be running and using BeanUtils. So if you have ActionA registering ConverterA for java.util.Date, and ActionB registering ConverterB for java.util.Date, and two different users trigger these two actions at roughly the same time, the last converter that got registered is the one that will be called when BeanUtils.copyProperties() gets called.
I only recently became aware of BeanUtils' non-static object counterparts, and I haven't had a chance to use them yet or figure out if Struts can use them.
I think I raised this question recently on the user list, but if not, it's worth raising again. What would be a plausible configuration model for Struts to use multiple instances of the beanutils classes? Ted has (at least once) suggested giving ActionForm the responsibility for population itself (by adding a "populate" method) -- this makes a certain amount of sense, but before implementing it, I would want to try hard to come up with a design which insulated Struts from the details of the HTTP Servlet API.
If not that, could anyone suggest a way to support this which wasn't too cumbersome?
Joe
You're right, though. If the same converter will be used throughout the application, then there's no conflict, and it may as well be registered in a plugin.
Hubert
On Sun, 30 Jan 2005 15:53:28 -0600, Kishore Senji <[EMAIL PROTECTED]> wrote:> Wouldn't you then run into possible conflicts if you have other areas > of the code or other forms using BeanUtils?
May be I misunderstood. I thought he is using that (a special)converter only for a specific action (registering the converter inside the execute method) and he wants that converter not to be there once the action saves the form in the execute. If the converter is needed for form population or some where else best thing is to register the converter in a Plugin.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--
Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com "Narrow minds are weapons made for mass destruction" -The Ex
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]