Re: LabelValueBeans

2004-06-23 Thread Joe Germuska
At 1:31 PM -0400 6/23/04, CRANFORD, CHRIS wrote:
Is there anyway to have a property in my ActionForm class be defined as
follows:
private LabelValueBean[] myItems;
And be able to have struts automatically populate this collection when the
form is submitted?  If so, how do I go about storing those values in the
form so they're seen and populated properly upon submission?
Well, a LabelValueBean has two string properties -- how would you 
automatically populate even a single instance, let alone an array?

Or are you suggesting that the form presents the user with a series 
of paired input fields, essentially "label1", "value1", "label2", 
"value2", etc?

If so, you could essentially do it by exposing an indexed property, 
"labelValueBeans" and then arranging to have your request parameters 
be named as such:

labelValueBeans[0].label
labelValueBeans[0].value
labelValueBeans[1].label
labelValueBeans[1].value
I would do this using c:forEach and the struts-el tags, roughly like this:

Label: 
Value: 

If you aren't using the EL, there are other ways to do this, but 
frankly, I never learned how to do them and I think it's cleaner with 
the JSTL.

Joe
--
--
Joe Germuska
Vice President, Software Development
JGSullivan Interactive, Inc.
[EMAIL PROTECTED]   312/943-1600 x2488 (v)  312/943-9675 (f)
[EMAIL PROTECTED]   312/404-3783 (m)
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: LabelValueBeans

2004-06-23 Thread Michael McGrady
You can rewrite or extend the class to suit yourself, of course.
At 10:52 AM 6/23/2004, James Mitchell wrote:
No, look at the source for the class and you'll see why.

--
James Mitchell
Software Engineer / Open Source Evangelist
EdgeTech, Inc.
678.910.8017
AIM: jmitchtx
- Original Message -
From: "CRANFORD, CHRIS" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, June 23, 2004 1:31 PM
Subject: LabelValueBeans
> Is there anyway to have a property in my ActionForm class be defined as
> follows:
>
> private LabelValueBean[] myItems;
>
> And be able to have struts automatically populate this collection when the
> form is submitted?  If so, how do I go about storing those values in the
> form so they're seen and populated properly upon submission?
>
> Thanks!
> Chris
>

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


RE: LabelValueBeans

2004-06-23 Thread CRANFORD, CHRIS
Found my problem.  I didn't have a getter method:

  public LabelValueBean getManufacturers(int index) {
  }

Thanks
Chris

-Original Message-
From: CRANFORD, CHRIS [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, June 23, 2004 2:05 PM
To: 'Struts Users Mailing List'
Subject: RE: LabelValueBeans


I think 1.2.  When I look at the properties in my editor on this 
object, I do see:

 setLabel(java.lang.String) 
 setValue(java.lang.String)

So how would one create a form element in their JSP to populate an array of
LabelValueBeans?

I'm getting the following error:
javax.servlet.ServletException: BeanUtils.populate
at
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1098)
at
org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.j
ava:816)
at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)

And my form uses

  
  

Thanks
Chris

-Original Message-
From: James Mitchell [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, June 23, 2004 2:04 PM
To: Struts Users Mailing List
Subject: Re: LabelValueBeans


Last time I looked there were getters but no setters.  What version are you
running?



--
James Mitchell
Software Engineer / Open Source Evangelist
EdgeTech, Inc.
678.910.8017
AIM: jmitchtx

- Original Message -
From: "CRANFORD, CHRIS" <[EMAIL PROTECTED]>
To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
Sent: Wednesday, June 23, 2004 1:57 PM
Subject: RE: LabelValueBeans


> I saw an example somewhere using indexed properties like:
>
>   labelvalue[index].label
>   labelvalue[index].value
>
> If I can get at the data this way, there is no way to set it? Chris
>
> -Original Message-
> From: James Mitchell [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, June 23, 2004 1:52 PM
> To: Struts Users Mailing List
> Subject: Re: LabelValueBeans
>
>
> No, look at the source for the class and you'll see why.
>
>
>
> --
> James Mitchell
> Software Engineer / Open Source Evangelist
> EdgeTech, Inc.
> 678.910.8017
> AIM: jmitchtx
>
> - Original Message -
> From: "CRANFORD, CHRIS" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, June 23, 2004 1:31 PM
> Subject: LabelValueBeans
>
>
> > Is there anyway to have a property in my ActionForm class be defined
> > as
> > follows:
> >
> > private LabelValueBean[] myItems;
> >
> > And be able to have struts automatically populate this collection
> > when the form is submitted?  If so, how do I go about storing those 
> > values in the form so they're seen and populated properly upon 
> > submission?
> >
> > Thanks!
> > Chris
> >
>
>
>
> -
> 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]
>
>



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


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



RE: LabelValueBeans

2004-06-23 Thread CRANFORD, CHRIS
I think 1.2.  When I look at the properties in my editor on this 
object, I do see:

 setLabel(java.lang.String) 
 setValue(java.lang.String)

So how would one create a form element in their JSP to populate an array of
LabelValueBeans?

I'm getting the following error:
javax.servlet.ServletException: BeanUtils.populate
at
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1098)
at
org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.j
ava:816)
at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)

And my form uses

  
  

Thanks
Chris

-Original Message-
From: James Mitchell [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, June 23, 2004 2:04 PM
To: Struts Users Mailing List
Subject: Re: LabelValueBeans


Last time I looked there were getters but no setters.  What version are you
running?



--
James Mitchell
Software Engineer / Open Source Evangelist
EdgeTech, Inc.
678.910.8017
AIM: jmitchtx

- Original Message -
From: "CRANFORD, CHRIS" <[EMAIL PROTECTED]>
To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
Sent: Wednesday, June 23, 2004 1:57 PM
Subject: RE: LabelValueBeans


> I saw an example somewhere using indexed properties like:
>
>   labelvalue[index].label
>   labelvalue[index].value
>
> If I can get at the data this way, there is no way to set it? Chris
>
> -Original Message-
> From: James Mitchell [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, June 23, 2004 1:52 PM
> To: Struts Users Mailing List
> Subject: Re: LabelValueBeans
>
>
> No, look at the source for the class and you'll see why.
>
>
>
> --
> James Mitchell
> Software Engineer / Open Source Evangelist
> EdgeTech, Inc.
> 678.910.8017
> AIM: jmitchtx
>
> - Original Message -
> From: "CRANFORD, CHRIS" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, June 23, 2004 1:31 PM
> Subject: LabelValueBeans
>
>
> > Is there anyway to have a property in my ActionForm class be defined 
> > as
> > follows:
> >
> > private LabelValueBean[] myItems;
> >
> > And be able to have struts automatically populate this collection 
> > when the form is submitted?  If so, how do I go about storing those 
> > values in the form so they're seen and populated properly upon 
> > submission?
> >
> > Thanks!
> > Chris
> >
>
>
>
> -
> 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]
>
>



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



Re: LabelValueBeans

2004-06-23 Thread James Mitchell
Hmm...sorry for the misinformation, seems it has had them for a whilenot
sure what I was thinking  (need more coffee)

So, ignore me.


--
James Mitchell
Software Engineer / Open Source Evangelist
EdgeTech, Inc.
678.910.8017
AIM: jmitchtx

- Original Message -
From: "James Mitchell" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Wednesday, June 23, 2004 2:04 PM
Subject: Re: LabelValueBeans


> Last time I looked there were getters but no setters.  What version are
you
> running?
>
>
>
> --
> James Mitchell
> Software Engineer / Open Source Evangelist
> EdgeTech, Inc.
> 678.910.8017
> AIM: jmitchtx
>
> - Original Message -
> From: "CRANFORD, CHRIS" <[EMAIL PROTECTED]>
> To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
> Sent: Wednesday, June 23, 2004 1:57 PM
> Subject: RE: LabelValueBeans
>
>
> > I saw an example somewhere using indexed properties like:
> >
> >   labelvalue[index].label
> >   labelvalue[index].value
> >
> > If I can get at the data this way, there is no way to set it?
> > Chris
> >
> > -----Original Message-
> > From: James Mitchell [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, June 23, 2004 1:52 PM
> > To: Struts Users Mailing List
> > Subject: Re: LabelValueBeans
> >
> >
> > No, look at the source for the class and you'll see why.
> >
> >
> >
> > --
> > James Mitchell
> > Software Engineer / Open Source Evangelist
> > EdgeTech, Inc.
> > 678.910.8017
> > AIM: jmitchtx
> >
> > - Original Message -
> > From: "CRANFORD, CHRIS" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Wednesday, June 23, 2004 1:31 PM
> > Subject: LabelValueBeans
> >
> >
> > > Is there anyway to have a property in my ActionForm class be defined
> > > as
> > > follows:
> > >
> > > private LabelValueBean[] myItems;
> > >
> > > And be able to have struts automatically populate this collection when
> > > the form is submitted?  If so, how do I go about storing those values
> > > in the form so they're seen and populated properly upon submission?
> > >
> > > Thanks!
> > > Chris
> > >
> >
> >
> >
> > -
> > 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]
> >
> >
>
>
>
> -
> 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]



Re: LabelValueBeans

2004-06-23 Thread James Mitchell
Last time I looked there were getters but no setters.  What version are you
running?



--
James Mitchell
Software Engineer / Open Source Evangelist
EdgeTech, Inc.
678.910.8017
AIM: jmitchtx

- Original Message -
From: "CRANFORD, CHRIS" <[EMAIL PROTECTED]>
To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
Sent: Wednesday, June 23, 2004 1:57 PM
Subject: RE: LabelValueBeans


> I saw an example somewhere using indexed properties like:
>
>   labelvalue[index].label
>   labelvalue[index].value
>
> If I can get at the data this way, there is no way to set it?
> Chris
>
> -Original Message-
> From: James Mitchell [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, June 23, 2004 1:52 PM
> To: Struts Users Mailing List
> Subject: Re: LabelValueBeans
>
>
> No, look at the source for the class and you'll see why.
>
>
>
> --
> James Mitchell
> Software Engineer / Open Source Evangelist
> EdgeTech, Inc.
> 678.910.8017
> AIM: jmitchtx
>
> - Original Message -
> From: "CRANFORD, CHRIS" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, June 23, 2004 1:31 PM
> Subject: LabelValueBeans
>
>
> > Is there anyway to have a property in my ActionForm class be defined
> > as
> > follows:
> >
> > private LabelValueBean[] myItems;
> >
> > And be able to have struts automatically populate this collection when
> > the form is submitted?  If so, how do I go about storing those values
> > in the form so they're seen and populated properly upon submission?
> >
> > Thanks!
> > Chris
> >
>
>
>
> -
> 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]
>
>



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



RE: LabelValueBeans

2004-06-23 Thread CRANFORD, CHRIS
I saw an example somewhere using indexed properties like:

  labelvalue[index].label
  labelvalue[index].value

If I can get at the data this way, there is no way to set it?  
Chris

-Original Message-
From: James Mitchell [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, June 23, 2004 1:52 PM
To: Struts Users Mailing List
Subject: Re: LabelValueBeans


No, look at the source for the class and you'll see why.



--
James Mitchell
Software Engineer / Open Source Evangelist
EdgeTech, Inc.
678.910.8017
AIM: jmitchtx

- Original Message -
From: "CRANFORD, CHRIS" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, June 23, 2004 1:31 PM
Subject: LabelValueBeans


> Is there anyway to have a property in my ActionForm class be defined 
> as
> follows:
>
> private LabelValueBean[] myItems;
>
> And be able to have struts automatically populate this collection when 
> the form is submitted?  If so, how do I go about storing those values 
> in the form so they're seen and populated properly upon submission?
>
> Thanks!
> Chris
>



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



Re: LabelValueBeans

2004-06-23 Thread James Mitchell
No, look at the source for the class and you'll see why.



--
James Mitchell
Software Engineer / Open Source Evangelist
EdgeTech, Inc.
678.910.8017
AIM: jmitchtx

- Original Message -
From: "CRANFORD, CHRIS" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, June 23, 2004 1:31 PM
Subject: LabelValueBeans


> Is there anyway to have a property in my ActionForm class be defined as
> follows:
>
> private LabelValueBean[] myItems;
>
> And be able to have struts automatically populate this collection when the
> form is submitted?  If so, how do I go about storing those values in the
> form so they're seen and populated properly upon submission?
>
> Thanks!
> Chris
>



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