I see. Really looking forward to seeing the JSF spec.
At 11:06 am 08-08-2002, you wrote: >On Thu, 8 Aug 2002, John Yu wrote: > > > Date: Thu, 08 Aug 2002 10:14:55 +0800 > > From: John Yu <[EMAIL PROTECTED]> > > Reply-To: Struts Developers List <[EMAIL PROTECTED]> > > To: Struts Developers List <[EMAIL PROTECTED]> > > Subject: Type conversion and exception handling [Was Re: DynaForm and > > Converters] > > > > (I'm thinking out loud here. :-) > > > > I see this dilemma: > > * We want automation for converting the data types in the formbeans. > > Since Struts performs automatic population of the beans already, it seems > > 'natural' to have Struts does the conversion at the same time. > > > >The first part of that is not a leap I'm ready to make yet -- that's not >why form beans exist in the first place. Their *sole* purpose, as far as >the architecture of the framework is concerned, is to make it possible to >reproduce the state of an input page in the face of bad input. > >The real issue is that form bean properties are not fine grained enough, >*or* complex enough, to do all the stuff we'd like. We should really want >to have components that know how to render themselves, convert themselves, >validate themselves, render their children (so that you can compose >complicated things out of simple things), and update the underlying >model-tier objects. Application frameworks should not have to worry about >such things. > > > * However, if Struts does the conversion when populating the beans, we > > will lose the control of handling the conversion exceptions if anything > > goes wrong. > > I'm wondering what if the conversion routine provides some sort of > > declarative exception handling mechanism? > > > > <form-bean name="myBean" type="myPackage.MyBean" > > conversionExceptionHandler="myPackage.ConversionExceptionHandler"/> > > > > Then the ConversionExceptionHandler.handleEx(String beanName, String > > propertyName, Exception reason) is called when exception occurs. > > > > Or even better, make the converter pluggable and each pluggable converter > > must also implement the above handleEx() method: > > > > <form-bean name="myBean" type="myPackage.MyBean" > > conversionExceptionHandler="myPackage.ConversionExceptionHandler"> > > > > <form-property name="property1" converter="myPackage.Converter1"/> > > <form-property name="property2" converter="myPackage.Converter2"/> > > ... > > </form-bean> > > > > Does it make sense? > >If JavaServer Faces weren't coming down the pike, it might well make >sense. But the future is going to be much better than what this feature >would enable, IMHO ... more news when JSR-127 eventually goes to public >draft. > > > John > >Craig -- John Yu Scioworks Technologies e: [EMAIL PROTECTED] w: +(65) 873 5989 w: http://www.scioworks.com m: +(65) 9782 9610 Scioworks Camino - "Don't develop Struts Apps without it! -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>