I'm willing to take criticism, but I must admit that I don't understand what you're trying to say -- so I can't really respond to you except to say this:
Marc wanted a way to handle the case where an object in the ognl chain was null. 4 different proposals were given. I gave mine as an option and stated why I preferred it over the other three. If you'd like to restate your objection to my suggestion I'm willing to respond. I'm always interested in learning better ways to do something, I just didn't understand your response. -Mike On 3/28/06, adasal <[EMAIL PROTECTED]> wrote: > Mike, > Not sure howm much your solution is a solution. If you have an object with > upwards of 3000 nodes and, moreover, the need is to do > getObjectUsefullName().getPropertyOtherUsefullName() in different > combinations. > While OGNL fascilitated this, because usefull names are not lost and also > those paths can ne encoded in Hivemind rules to e.g. inject values into the > object being called, a difficulty I encountered was whether the call should > be > getParentOfObjectUsefullName().getObjectUsefullName().getPropertyOtherUsefullName() > or getObjectUsefullName().getPropertyOtherUsefullName() as only one would > ensure the parent was instantiated correctly and non null for the property > call. With a large object graph this, of course, bearing in mind differences > between testing and production, was a puzzle. > Adam > > On 28/03/06, Mike Snare <[EMAIL PROTECTED]> wrote: > > > > Another way is to use an accessor method in the container, e.g. > > getFOTitle(). Implementation as follows: > > > > public String getFOTitle() { > > FirstObject fo = getFirstObject(); > > if (fo != null) { > > return fo.getTitle(); > > } > > return ""; > > } > > > > It has the benefits of not needing to use the pageBeginRender, not > > requiring a bean to store it (plus the hit of object creation), and > > reducing the ognl work that needs to be done. > > > > Then in your template just use ognl:FOTitle. > > > > -Mike > > > > On 3/28/06, Eduardo Valentim <[EMAIL PROTECTED]> wrote: > > > Hi marc, > > > > > > You can do this in your page class: > > > > > > @Bean > > > public abstract FirstObject getFirstObject(); > > > > > > or, put this in your .page: > > > > > > <bean name="firstObject" class="the.package.FirstObject"/> > > > > > > And in the ognl expression: > > > > > > ... value="ognl:beans.firstObject.title" ... > > > > > > AND leaves tapestry to work for you. > > > > > > I think that I am correct!!! :) > > > > > > On Tue, 2006-03-28 at 08:27 +0200, Marc Ende wrote: > > > > Hi, > > > > > > > > I'm currently looking for a solution for the following problem: > > > > > > > > I've got some @Input, @Text and @TextArea Fields in a Form. > > > > These are filled with a value="ognl:firstObject.title" for example. > > > > If the firstObject is null it causes an exception (source is null for > > > > getProperty(null, "title")) > > > > > > > > I've tried to do something like an @If with condition ognl:firstObject > > > > and conditionValue="null" to detect the null and avoid parsing the > > > > statements wich causes the exceptions. > > > > But this way wasn't successful. > > > > > > > > So, my question: wich is the common way to handle this cases? > > > > > > > > Thanks for your help. > > > > > > > > marc > > > > > > > > --------------------------------------------------------------------- > > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]