struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Milan Milanovic <milanmilanov...@yahoo.com>
Subject Re: [Struts 2] Simple combobox behaviour
Date Thu, 15 May 2008 22:09:08 GMT
I'm just not sure when I put listValue = "name" and listKey="id" I get and emtpy combo box
with exactly 4 places (it have value option good) ?

One more thing, if I have object Person buyer; in my Fruit class (with get/set methods), and
I have Fruit fruit object in my action class, where I also have List<Person>allBuyers
in my action class. How can I define combo box so that when buyer is selected, that Person
object should be set to my fruit.buyer object ?

--
Thx, Milan

Felipe Lorenz <felipe.lorenz@gmail.com> wrote: Ok.. if i get your idea... the list yout
want to put in combobox is
fruit.buyers, hummmm?

Then, try it:

listKey="personId" name="fruit.buyers" emtpyOption="false"
hedaerKey="none"/>

if you have the object fruit, then:

listValue="personName" listKey="personId" name="fruit.buyers"
emtpyOption="false"  hedaerKey="none"/>

maybe the name is not correct. Try chage the attr name to person, for
example.


listValue="personName" listKey="personId" name="person" emtpyOption="false"
hedaerKey="none"/>

On Thu, May 15, 2008 at 6:05 PM, Milan Milanovic 
wrote:

> When I set listKey="fruit.buyers.id", I get a empty combo box, but with
> correct number of emtpy spaces (in my case 4) ?
>
> --
> Thanks, Milan
>
> Felipe Lorenz  wrote: You need eht attribute
> "listKey" where you'll put the Person id!!!
>
> see:
>
> http://struts.apache.org/2.x/struts2-core/apidocs/org/apache/struts2/components/Select.html
>
> On Thu, May 15, 2008 at 5:19 PM, Milan Milanovic
> wrote:
>
> > Hi,
> >
> > I have simple class Fruit, that have "id" (long), "name" (String), and
> > "buyers" List of
> . In my action class I have Fruit fruit; object
> > with get/set methods.
> >
> > In my jsp I have combo box defined like this:
> >
> >
> > emtpyOption="false" value = "fruit.buyers" hedaerKey="none"
> > multiple="false"/>
> >
> > and when I sumbit form that contain this combo box, it generates
> following
> > error:
> >
> > 22:16:18,281 ERROR
> > com.opensymphony.xwork2.interceptor.ParametersInterceptor:204 -
> > ParametersInterceptor - [setParameters]: Unexpected Exception caught
> setting
> > 'fruit.buyers' on class 'com.myproject.actions.FruitAction': Error
> setting
> > expression 'fruit.buyers' with value '[Ljava.lang.String;@15b4492'
> >
> >
> >
> >
>
>
>
>
>


       
Mime
  • Unnamed multipart/alternative (inline, 8-Bit, 0 bytes)
View raw message