Re: Condition to handle null in forms

2006-03-28 Thread adasal
Mike, Thanks. The null object pattern is discussed at some length in various places including Refactoring in Java by Joshua Kerievsky, but I just wondered how it played out for others. I think the idea is never to return a null, but I know I haven't been writing code like that. I can see the benefi

Re: Condition to handle null in forms

2006-03-28 Thread Mike Snare
Ok. Now I see your point. The problem is that even if you ensure that objects are created properly it's hard to ensure that the values don't get over-written with nulls -- unless of course you take the tack of using a flag value instead of null, using the flag value when the user tries to set an

Re: Condition to handle null in forms

2006-03-28 Thread adasal
Not really criticism, just comments/sharing my experience. (Remember that quirk of email that accentuates unment interpretations.) I'm just saying that I understand you to be suggesting additional code in the container that will reference the calls you wish to make, then the OGNL path is a one step

Re: Condition to handle null in forms

2006-03-28 Thread Mike Snare
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 an

Re: Condition to handle null in forms

2006-03-28 Thread adasal
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 pat

Re: Condition to handle null in forms

2006-03-28 Thread adasal
Presumably because the class enhancement knows not to (cannot) enhance a null! But there is also the null pattern. I can supply a reference for this later today if interested. This is where nulls are handled in the original class on the basis that really nulls stand in for something else. An exampl

Re: Condition to handle null in forms

2006-03-28 Thread Mike Snare
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 pageBeginRende

Re: Condition to handle null in forms

2006-03-28 Thread Eduardo Valentim
Hi marc, You can do this in your page class: @Bean public abstract FirstObject getFirstObject(); or, put this in your .page: 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, 20

Antwort: Re: Condition to handle null in forms

2006-03-28 Thread Kristian Marinkovic
maybe using pageBeginRender for init is a viable solution: extends BasePage implements PageBeginRenderListener{ ... public void pageBeginRender(PageEvent event) { if(getFirstObject() == null) setFirstObject(new Object()); } .. regards, kris

Re: Condition to handle null in forms

2006-03-28 Thread Sebastiaan van Erk
That is one way to do it, however make sure you use the right attributes. Regards, Sebastiaan 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.t