Mitchell Morris ([EMAIL PROTECTED]) wrote:

> Hmmm ... looking in the BeanUtils javadocs, I see there's already an
> IntegerArrayConverter which turns a String[] into an int[]. Oh look! The
> author's name seems oddly familiar; anybody know some guy named "Craig R.
> McClanahan"?
> 
> just-need-to-register-it-then-I-suppose-ly y'rs,
Aha!  Finally got to the bottom of this one by creating a little
test suite for myself.  Turns out that, besides ConvertUtils being
awesome, there is a dichotomy.

The conversion from String[] => int[] works as expected.

The conversion from int[] => String[] is some quirky shit.

Basically, int[] => String[] looks for some format like {1,2,3} as a
string and makes that into a String[] array, so it takes a String
and makes a string array.  To me, this is not really the right
converter at all.  Here is the issue, my model returns an int[]
array of industryIds.  My form has a select box which is
LabelValueBean collection which takes an array of String[].  So when
copyProperties takes my model bean to populate the form bean, it
turns a nice int array like

int[] industryIds = {2,8,9,2};

into 

String[] industryIds = {null,I,null,fd54d6}

As you can see, this will certainly not populate the form correctly.
So now I am digging into adding my own converter.  I will get back
to you when it is done.

Dan

-- 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Daniel Allen, <[EMAIL PROTECTED]>
http://www.mojavelinux.com/
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
"Personally, I'm not finding Windows 
to be less expensive to administer, 
but those security holes--that'll kill 'em," 
-- Al Gillen, IDC
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to