-----Original Message-----
From: Dan Allen [mailto:[EMAIL PROTECTED]
Sent: Saturday, March 15, 2003 9:14 AM
To: Struts Users Mailing List
Subject: Re: BeanUtils.copyProperties between from and DAO issues


Right, but I was hoping that perhaps it should do this conversion
itself.  Here's why.  It doesn't make sense for my DAO to be talking
about ids in string format, for that would be "out of character,"
catering to the view.  There isn't a way (that I know of) to get the
form to populate itself with an array of primitive or lang integers.
So therefore, I am asking, do I have to make my DAO bend over
backwards to fix this hole in the view?  And why can't
copyProperties handle this conversion?  Seems simple to me.

Dan

> Write a util function link longString in here:
>
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/basicportal/bP/WEB-INF/src/wa
r/org/apache/scaffoldingLib/util/BUtil.java
>
> You can just say in bean:
> List l = getDAOx().getResult();
>
> And now you have a list in you bean, populated by dao.
>
> .V
>
> Dan Allen wrote:
> > I just wanted to see if I am working an uphill battle here or this
> > is really the reality of the situation.  I think you all might find
> > this question particularly intriguing.
> >
> > Assume that my DAO (Data Access Object) is storing a list of ids
> > which matches with a relationship.  For example sake, it is a list
> > of Service Ids which coorespond to services available.  I have the
> > following method definitions
> >
> > public List setServices(List services) {}
> >
> > public List getServices() {}
> >
> > public void setServicesIds(int[] serviceIds) {}
> >
> > public int[] getServiceIds() {}
> >
> > In my form a have a mutiple-select which I populate with all the
> > industries from the database table.  The multiple-select is set as a
> > java.lang.String[] since all form elements must be of type String
> > (am I right?)
> >
> > Now, either I am populating from my form or populating to my form
> > using BeanUtils.copyProperties().  It would appear as though the
> > following conversion is failing horribly
> >
> > int[] --> String[]
> >
> > and
> >
> > String[] --> int[]
> >
> > ...since the data never populates or saves (I did change the methods to
> > using String[] instead of int[] and it worked, so I know the issue
> > is the datatype, not because I don't know how to setup a form in
> > struts, I did finally figure that much out).
> >
> > Short of creating method defintions which take and recieve String[]
> > arrays or manually iterating the form property in my Action class
> > and converting them to int[], is there any hope?
> >
> > <rant>
> > Why is is so d*** hard to convert between a string and a primitive
> > integer in Java???  Damn, in PHP you don't even blink when you have
> > these two types.
> > </rant>
> >
> > Dan

--
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Daniel Allen, <[EMAIL PROTECTED]>
http://www.mojavelinux.com/
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"This is a test of the Emergency Broadcast System.  If this had
been an actual emergency, do you really think we'd stick around
to tell you?"
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

---------------------------------------------------------------------
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]

Reply via email to