O/H Marcos Chicote έγραψε: > Thanks Andreas. > Before mailing to this list, I tried looking at the ognl documentation > and I > found the NullHandler interface but I wasn't sure how it worked with > Tapestry or if it was possible to do it another way without altering the > BOs. > > Correct me if I'm wrong but what I understand is that Tapestry already > implements a Hivemind service that does the null handling. All I have > to do > is make my BOs implement NullHandler interface. Am I right? Hmmm, not really... Tapestry simply provides that point so that your have a global way of registring handlers - so, making your BOs implement NullHandler is not enough
Also, i'm not sure if that's the correct approach - seems it polutes your BOs I think I'd create a service that would be able to null-handle your specific objects, and esp. of all those objects have a common superclass, i'd be able to register them all at once. I'll dig in for some code - it's been a while since i last used this > > Thanks a lot! > > Marcos > > On 6/29/07, Andreas Andreou <[EMAIL PROTECTED]> wrote: >> >> >> http://tapestry.apache.org/tapestry4.1/tapestry-framework/hivedoc/config/tapestry.ognl.NullHandlers.html >> >> >> the way it works, is that you associate implementations of >> http://www.ognl.org/2.6.9/Documentation/javadoc/ognl/NullHandler.html >> with class types whose methods (or properties) may return null >> >> O/H Marcos Chicote έγραψε: >> > Hi! >> > I have a Table component (actually I have TableRows, TableView, and >> all >> > those other components that form a Table) and one of the columns in >> > TableView is declared like this: columnName:object1.object2.property. >> > >> > As you can see this can throw NullPointerException if either >> object1 or >> > object2 are null. >> > >> > To solve this problem, I have to alternatives: >> > a) Use a Block component called columnNameColumnValue an inside the >> > block an >> > Insert component with a value asociated with the page's class that >> > handles >> > nulls >> > b) Declare the column like: columnName:object1.propertyObject2. (that >> > it a >> > getPropertyObject2 method in object1 class that handles nulls). >> > >> > Is there a better way to solve this?? I would love something like a >> > prefix >> > that allows me to specify that whenever a NPE is found, a blank >> space is >> > rendered. Is something like that possible? >> > >> > I'm ussing Tapestry 4.1.1. >> > >> > Btw, great work with Tap4.1.2, congratulations! >> > >> > Thanks! >> > >> >> -- >> Andreas Andreou - [EMAIL PROTECTED] - http://andyhot.di.uoa.gr >> Tapestry / Tacos developer >> Open Source / J2EE Consulting >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> -- Andreas Andreou - [EMAIL PROTECTED] - http://andyhot.di.uoa.gr Tapestry / Tacos developer Open Source / J2EE Consulting --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]