Re: Proposed changes to DefaultFormMap & FormType

Shawn Wilson <[email protected]>
Newsgroups gmane.comp.java.enhydra.barracuda.general
Message-ID <[email protected]>
Hey,

 > And I personally don't think that not storing the orig-value but null 
instead
 > is a good idea. This might cause trouble (think of calling toString() 
when

Okay I'm having a little trouble figuring out what you mean in this 
sentence :) so correct me if I misinterpret. I think you're saying that 
you think storing null instead of the orig-value in orig-value is a bad 
idea. I agree with this... if the orig-value is "" then the orig-value 
after mapping should still be "". Correct me if I'm wrong, but I believe 
that still holds true with my patch. What changes is that, when mapped 
from a ServletRequest, an 'orig-value' of "" maps to the 'value' of 
null. This makes sense because the ServletRequest doesn't give you any 
nulls for form elements on the page, they are all just empty strings.

Anyways I don't think I really have much to say here because I believe 
we're in agreement. I just looked at your changes and it looks good to 
me. I especially like the idea of the customizable isNull() function. 
That means that if this happens to break anyone's code they can at least 
work around it by overriding isNull() to only return true when 
origVal==null, since that was the previous behavior.

+1 from me!

-shawn

Diez B. Roggisch wrote:
> Hi,
> 
> Am Freitag, 4. April 2003 17:06 schrieb Shawn Wilson:
> 
>>The Zip file attached contains an updated version of DefaultFormMap that
>>I think accomplishes what we're talking about here. Look for
>>saw_040403.1. I don't think this breaks anything but of course I can't
>>be sure. Please provide any comments.
> 
> 
> Ok, here they are: In my opionion, the approach you took interferes with the 
> mapping too early. In the case of someone reusing a form-map for a second 
> mapping (this isn't a good idea in general, but might happen), the map would 
> end up in not overwriting a previously mapped value. 
> 
> And I personally don't think that not storing the orig-value but null instead 
> is a good idea. This might cause trouble (think of calling toString() when 
> repopulating the values). Your own comment says that you don't assume that a 
> request will give you a null for an origVal. So lets have this consistent in 
> the form-map as well. And even if the value might not be useful to us - its 
> still what the user has entered, and repopulation should give it back to him 
> or her.
> 
> I modified the DefaultFormMap in a slightly different way which will make sure 
> that the bug you discovered won't occur. I've attached it, so you can see if 
> it matches your needs. Look for dbr_. If its ok, I'll commit it.
> 
> Regards, Diez
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.