You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by fea jabi <zy...@hotmail.com> on 2005/12/21 20:35:19 UTC
html:multibox with LabelValueBean
Trying to use html:multibox with LabelValueBean.
Getting error doing the same.
<form-bean>
<form-property name="Items" type="java.util.ArrayList[]"/>
<form-property name="SelectedItems" type="java.util.ArrayList[]"/>
</form-bean>
In prepare Action
...............
...............
LabelValueBean lblValueBean1 = new LabelValueBean("Visa1", "V1");
LabelValueBean lblValueBean2 = new LabelValueBean("MasterCard1", "M1");
ArrayList misList = new ArrayList();
misList.add(lblValueBean1);
misList.add(lblValueBean2);
ArrayList selectedList = new ArrayList();
selectedList.add(lblValueBean1);
form.set("Items", misList);
form.set("SelectedItems", selectedList);
.....................
.
In JSP
............
..........
<logic:iterate id="item" property="Items">
<html:multibox property="selectedItems">
<bean:write name="item" property="value"/>
</html:multibox>
<bean:write name="item" property="label"/>
</logic:iterate>
not sure what's wrong in here.
Also, would like to know if it's better to use the logicIterate or JSTL to
loop thru the items as I am new to JSTL too.
Thanks.
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: html:multibox with LabelValueBean
Posted by Craig McClanahan <cr...@apache.org>.
On 12/22/05, fea jabi <zy...@hotmail.com> wrote:
>
> Thanks, Laurie. that worked.
>
> why is JSTL prefered over the logic tags? is there any doc I can read
> about
> the same?
>
> Thanks.
A couple of reasons I (as the original developer of the logic tags :-)
prefer the JSTL versions:
* The expression syntax for JSTL's logic tags is much more powerful
and concise.
* JSTL provides the equivalent of a "switch" statement in Java or C
for dealing with if/else or if-elseif-elseif-else type scenarios. Struts
does not.
See the <c:choose>, <c:when>, and <c:otherwise> tags.
* The JSTL tags are provided by the container, and can potentially be
performance optimized by the container provider.
* The JSTL expression syntax is now (as of JSP 2.0) available everywhere
in a JSP page, not just in tags that understand the syntax.
* The JSTL syntax is very similar to the JSF expression syntax, so if you
ever switch to using JSF for your view technology, you won't have to
learn a new expression language syntax.
The Struts logic tags preceeded JSTL, but they have basically been
superceded by the standard functionality. They're still in the library
primarily for backwards compatibility.
Craig
Re: html:multibox with LabelValueBean
Posted by Pazhanikanthan Periasamy <Pa...@caritor.com>.
If the requirement is deviated from the regular / common requirements,
then obviously it is possible. Based on my experience, I have not faced a
situation where I cannot use. Not offending anyone in particular, most of
such difficulties arise becoz some of us (developers including me) dont
know how to use the tag libs properly.
Thanks and regards,
Pazhanikanthan. P
Project Leader,
Caritor (India) Pvt. Ltd.,
Madras - 600 006
Mob: 9886152717
Extn: 40123
Srinivas Jadcharla <jd...@gmail.com>
12/22/2005 09:19 PM
Please respond to
"Struts Users Mailing List" <us...@struts.apache.org>
To
Struts Users Mailing List <us...@struts.apache.org>
cc
Subject
Re: html:multibox with LabelValueBean
I may be wrong but i saw in some situations i dont have proper tag libs in
struts.
On 12/22/05, Pazhanikanthan Periasamy
<Pa...@caritor.com>
wrote:
>
> Apache Struts developers are very very clever to ensure that you wont
get
> an oppurtunity for using JSTL :)
>
> Thanks and regards,
> Pazhanikanthan. P
> Project Leader,
> Caritor (India) Pvt. Ltd.,
> Madras - 600 006
> Mob: 9886152717
> Extn: 40123
>
>
>
> Srinivas Jadcharla <jd...@gmail.com>
> 12/22/2005 09:14 PM
> Please respond to
> "Struts Users Mailing List" <us...@struts.apache.org>
>
>
> To
> Struts Users Mailing List <us...@struts.apache.org>
> cc
>
> Subject
> Re: html:multibox with LabelValueBean
>
>
>
>
>
>
> I think its always better to use Struts taglibs where ever it is
possible
> because of less coding.Where exactly we need JSTL(Wild guess .where its
> not
> possible with Struts tag libs?) .Correct me if iam wrong
>
> On 12/22/05, Pazhanikanthan Periasamy
> <Pa...@caritor.com>
> wrote:
> >
> > Hello Fea,
> >
> > I dont think, there are any differences in the way both JSTL and
Struts
> > logic tags work. Fundamentally they both iterate the same input array
> and
> > produce the output. Using Logic Iterate tags, you can eliminate many
> > scriptlet tags that you might end up using when you use JSTL scripts.
> The
> > choice is yours as to which to choose.
> >
> > JSTL is Java standard. Logic Iterate is Struts specific.
> >
> > Thanks and regards,
> > Pazhanikanthan. P
> > Project Leader,
> > Caritor (India) Pvt. Ltd.,
> > Madras - 600 006
> > Mob: 9886152717
> > Extn: 40123
> >
> >
> >
> > "fea jabi" <zy...@hotmail.com>
> > 12/22/2005 09:03 PM
> > Please respond to
> > "Struts Users Mailing List" <us...@struts.apache.org>
> >
> >
> > To
> > user@struts.apache.org
> > cc
> >
> > Subject
> > Re: html:multibox with LabelValueBean
> >
> >
> >
> >
> >
> >
> > Thanks, Laurie. that worked.
> >
> > why is JSTL prefered over the logic tags? is there any doc I can read
> > about
> > the same?
> >
> > Thanks.
> >
> >
> > >From: Laurie Harper <la...@holoweb.net>
> > >Reply-To: "Struts Users Mailing List" <us...@struts.apache.org>
> > >To: user@struts.apache.org
> > >Subject: Re: html:multibox with LabelValueBean
> > >Date: Wed, 21 Dec 2005 16:55:06 -0500
> > >
> > >fea jabi wrote:
> > >>Trying to use html:multibox with LabelValueBean.
> > >>
> > >>Getting error doing the same.
> > >>
> > >><form-bean>
> > >> <form-property name="Items" type="java.util.ArrayList[]"/>
> > >> <form-property name="SelectedItems"
> > >>type="java.util.ArrayList[]"/>
> > >></form-bean>
> > >>
> > >>
> > >>
> > >>In prepare Action
> > >>...............
> > >>...............
> > >>
> > >>LabelValueBean lblValueBean1 = new LabelValueBean("Visa1", "V1");
> > >>LabelValueBean lblValueBean2 = new LabelValueBean("MasterCard1",
> "M1");
> > >>
> > >>
> > >> ArrayList misList = new ArrayList();
> > >> misList.add(lblValueBean1);
> > >> misList.add(lblValueBean2);
> > >>
> > >> ArrayList selectedList = new ArrayList();
> > >> selectedList.add(lblValueBean1);
> > >>
> > >> form.set("Items", misList);
> > >> form.set("SelectedItems", selectedList);
> > >>.....................
> > >>.
> > >>
> > >>
> > >>In JSP
> > >>............
> > >>..........
> > >><logic:iterate id="item" property="Items">
> > >> <html:multibox property="selectedItems">
> > >> <bean:write name="item" property="value"/>
> > >> </html:multibox>
> > >> <bean:write name="item" property="label"/>
> > >></logic:iterate>
> > >>
> > >>
> > >>not sure what's wrong in here.
> > >
> > >For one thing, you've declared your form bean properties to be of
type
> > >ArrayList[], but you're actually setting them with just ArrayList --
> i.e.
> >
> > >you're declaring an array of lists, but only supplying a single list.
> > Don't
> > >know if that's the problem but it's definitely odd :-)
> > >
> > >>Also, would like to know if it's better to use the logicIterate or
> JSTL
> > to
> > >>loop thru the items as I am new to JSTL too.
> > >
> > >In general the JSTL tags should be prefered over the Struts logic
tags,
> > >though either will work fine in most cases.
> > >
> > >L.
> > >
> > >
> > >---------------------------------------------------------------------
> > >To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > >For additional commands, e-mail: user-help@struts.apache.org
> > >
> >
> > _________________________________________________________________
> > Express yourself instantly with MSN Messenger! Download today - it's
> FREE!
> >
> > http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
> >
> >
>
>
> --
> Thanks & RegardsSrinivas732-648-9421(Cell)
>
>
>
--
Thanks & RegardsSrinivas732-648-9421(Cell)
Re: html:multibox with LabelValueBean
Posted by Srinivas Jadcharla <jd...@gmail.com>.
I may be wrong but i saw in some situations i dont have proper tag libs in
struts.
On 12/22/05, Pazhanikanthan Periasamy <Pa...@caritor.com>
wrote:
>
> Apache Struts developers are very very clever to ensure that you wont get
> an oppurtunity for using JSTL :)
>
> Thanks and regards,
> Pazhanikanthan. P
> Project Leader,
> Caritor (India) Pvt. Ltd.,
> Madras - 600 006
> Mob: 9886152717
> Extn: 40123
>
>
>
> Srinivas Jadcharla <jd...@gmail.com>
> 12/22/2005 09:14 PM
> Please respond to
> "Struts Users Mailing List" <us...@struts.apache.org>
>
>
> To
> Struts Users Mailing List <us...@struts.apache.org>
> cc
>
> Subject
> Re: html:multibox with LabelValueBean
>
>
>
>
>
>
> I think its always better to use Struts taglibs where ever it is possible
> because of less coding.Where exactly we need JSTL(Wild guess .where its
> not
> possible with Struts tag libs?) .Correct me if iam wrong
>
> On 12/22/05, Pazhanikanthan Periasamy
> <Pa...@caritor.com>
> wrote:
> >
> > Hello Fea,
> >
> > I dont think, there are any differences in the way both JSTL and Struts
> > logic tags work. Fundamentally they both iterate the same input array
> and
> > produce the output. Using Logic Iterate tags, you can eliminate many
> > scriptlet tags that you might end up using when you use JSTL scripts.
> The
> > choice is yours as to which to choose.
> >
> > JSTL is Java standard. Logic Iterate is Struts specific.
> >
> > Thanks and regards,
> > Pazhanikanthan. P
> > Project Leader,
> > Caritor (India) Pvt. Ltd.,
> > Madras - 600 006
> > Mob: 9886152717
> > Extn: 40123
> >
> >
> >
> > "fea jabi" <zy...@hotmail.com>
> > 12/22/2005 09:03 PM
> > Please respond to
> > "Struts Users Mailing List" <us...@struts.apache.org>
> >
> >
> > To
> > user@struts.apache.org
> > cc
> >
> > Subject
> > Re: html:multibox with LabelValueBean
> >
> >
> >
> >
> >
> >
> > Thanks, Laurie. that worked.
> >
> > why is JSTL prefered over the logic tags? is there any doc I can read
> > about
> > the same?
> >
> > Thanks.
> >
> >
> > >From: Laurie Harper <la...@holoweb.net>
> > >Reply-To: "Struts Users Mailing List" <us...@struts.apache.org>
> > >To: user@struts.apache.org
> > >Subject: Re: html:multibox with LabelValueBean
> > >Date: Wed, 21 Dec 2005 16:55:06 -0500
> > >
> > >fea jabi wrote:
> > >>Trying to use html:multibox with LabelValueBean.
> > >>
> > >>Getting error doing the same.
> > >>
> > >><form-bean>
> > >> <form-property name="Items" type="java.util.ArrayList[]"/>
> > >> <form-property name="SelectedItems"
> > >>type="java.util.ArrayList[]"/>
> > >></form-bean>
> > >>
> > >>
> > >>
> > >>In prepare Action
> > >>...............
> > >>...............
> > >>
> > >>LabelValueBean lblValueBean1 = new LabelValueBean("Visa1", "V1");
> > >>LabelValueBean lblValueBean2 = new LabelValueBean("MasterCard1",
> "M1");
> > >>
> > >>
> > >> ArrayList misList = new ArrayList();
> > >> misList.add(lblValueBean1);
> > >> misList.add(lblValueBean2);
> > >>
> > >> ArrayList selectedList = new ArrayList();
> > >> selectedList.add(lblValueBean1);
> > >>
> > >> form.set("Items", misList);
> > >> form.set("SelectedItems", selectedList);
> > >>.....................
> > >>.
> > >>
> > >>
> > >>In JSP
> > >>............
> > >>..........
> > >><logic:iterate id="item" property="Items">
> > >> <html:multibox property="selectedItems">
> > >> <bean:write name="item" property="value"/>
> > >> </html:multibox>
> > >> <bean:write name="item" property="label"/>
> > >></logic:iterate>
> > >>
> > >>
> > >>not sure what's wrong in here.
> > >
> > >For one thing, you've declared your form bean properties to be of type
> > >ArrayList[], but you're actually setting them with just ArrayList --
> i.e.
> >
> > >you're declaring an array of lists, but only supplying a single list.
> > Don't
> > >know if that's the problem but it's definitely odd :-)
> > >
> > >>Also, would like to know if it's better to use the logicIterate or
> JSTL
> > to
> > >>loop thru the items as I am new to JSTL too.
> > >
> > >In general the JSTL tags should be prefered over the Struts logic tags,
> > >though either will work fine in most cases.
> > >
> > >L.
> > >
> > >
> > >---------------------------------------------------------------------
> > >To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > >For additional commands, e-mail: user-help@struts.apache.org
> > >
> >
> > _________________________________________________________________
> > Express yourself instantly with MSN Messenger! Download today - it's
> FREE!
> >
> > http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
> >
> >
>
>
> --
> Thanks & RegardsSrinivas732-648-9421(Cell)
>
>
>
--
Thanks & RegardsSrinivas732-648-9421(Cell)
Re: html:multibox with LabelValueBean
Posted by Pazhanikanthan Periasamy <Pa...@caritor.com>.
Apache Struts developers are very very clever to ensure that you wont get
an oppurtunity for using JSTL :)
Thanks and regards,
Pazhanikanthan. P
Project Leader,
Caritor (India) Pvt. Ltd.,
Madras - 600 006
Mob: 9886152717
Extn: 40123
Srinivas Jadcharla <jd...@gmail.com>
12/22/2005 09:14 PM
Please respond to
"Struts Users Mailing List" <us...@struts.apache.org>
To
Struts Users Mailing List <us...@struts.apache.org>
cc
Subject
Re: html:multibox with LabelValueBean
I think its always better to use Struts taglibs where ever it is possible
because of less coding.Where exactly we need JSTL(Wild guess .where its
not
possible with Struts tag libs?) .Correct me if iam wrong
On 12/22/05, Pazhanikanthan Periasamy
<Pa...@caritor.com>
wrote:
>
> Hello Fea,
>
> I dont think, there are any differences in the way both JSTL and Struts
> logic tags work. Fundamentally they both iterate the same input array
and
> produce the output. Using Logic Iterate tags, you can eliminate many
> scriptlet tags that you might end up using when you use JSTL scripts.
The
> choice is yours as to which to choose.
>
> JSTL is Java standard. Logic Iterate is Struts specific.
>
> Thanks and regards,
> Pazhanikanthan. P
> Project Leader,
> Caritor (India) Pvt. Ltd.,
> Madras - 600 006
> Mob: 9886152717
> Extn: 40123
>
>
>
> "fea jabi" <zy...@hotmail.com>
> 12/22/2005 09:03 PM
> Please respond to
> "Struts Users Mailing List" <us...@struts.apache.org>
>
>
> To
> user@struts.apache.org
> cc
>
> Subject
> Re: html:multibox with LabelValueBean
>
>
>
>
>
>
> Thanks, Laurie. that worked.
>
> why is JSTL prefered over the logic tags? is there any doc I can read
> about
> the same?
>
> Thanks.
>
>
> >From: Laurie Harper <la...@holoweb.net>
> >Reply-To: "Struts Users Mailing List" <us...@struts.apache.org>
> >To: user@struts.apache.org
> >Subject: Re: html:multibox with LabelValueBean
> >Date: Wed, 21 Dec 2005 16:55:06 -0500
> >
> >fea jabi wrote:
> >>Trying to use html:multibox with LabelValueBean.
> >>
> >>Getting error doing the same.
> >>
> >><form-bean>
> >> <form-property name="Items" type="java.util.ArrayList[]"/>
> >> <form-property name="SelectedItems"
> >>type="java.util.ArrayList[]"/>
> >></form-bean>
> >>
> >>
> >>
> >>In prepare Action
> >>...............
> >>...............
> >>
> >>LabelValueBean lblValueBean1 = new LabelValueBean("Visa1", "V1");
> >>LabelValueBean lblValueBean2 = new LabelValueBean("MasterCard1",
"M1");
> >>
> >>
> >> ArrayList misList = new ArrayList();
> >> misList.add(lblValueBean1);
> >> misList.add(lblValueBean2);
> >>
> >> ArrayList selectedList = new ArrayList();
> >> selectedList.add(lblValueBean1);
> >>
> >> form.set("Items", misList);
> >> form.set("SelectedItems", selectedList);
> >>.....................
> >>.
> >>
> >>
> >>In JSP
> >>............
> >>..........
> >><logic:iterate id="item" property="Items">
> >> <html:multibox property="selectedItems">
> >> <bean:write name="item" property="value"/>
> >> </html:multibox>
> >> <bean:write name="item" property="label"/>
> >></logic:iterate>
> >>
> >>
> >>not sure what's wrong in here.
> >
> >For one thing, you've declared your form bean properties to be of type
> >ArrayList[], but you're actually setting them with just ArrayList --
i.e.
>
> >you're declaring an array of lists, but only supplying a single list.
> Don't
> >know if that's the problem but it's definitely odd :-)
> >
> >>Also, would like to know if it's better to use the logicIterate or
JSTL
> to
> >>loop thru the items as I am new to JSTL too.
> >
> >In general the JSTL tags should be prefered over the Struts logic tags,
> >though either will work fine in most cases.
> >
> >L.
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >For additional commands, e-mail: user-help@struts.apache.org
> >
>
> _________________________________________________________________
> Express yourself instantly with MSN Messenger! Download today - it's
FREE!
>
> http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
>
--
Thanks & RegardsSrinivas732-648-9421(Cell)
Re: html:multibox with LabelValueBean
Posted by Srinivas Jadcharla <jd...@gmail.com>.
I think its always better to use Struts taglibs where ever it is possible
because of less coding.Where exactly we need JSTL(Wild guess .where its not
possible with Struts tag libs?) .Correct me if iam wrong
On 12/22/05, Pazhanikanthan Periasamy <Pa...@caritor.com>
wrote:
>
> Hello Fea,
>
> I dont think, there are any differences in the way both JSTL and Struts
> logic tags work. Fundamentally they both iterate the same input array and
> produce the output. Using Logic Iterate tags, you can eliminate many
> scriptlet tags that you might end up using when you use JSTL scripts. The
> choice is yours as to which to choose.
>
> JSTL is Java standard. Logic Iterate is Struts specific.
>
> Thanks and regards,
> Pazhanikanthan. P
> Project Leader,
> Caritor (India) Pvt. Ltd.,
> Madras - 600 006
> Mob: 9886152717
> Extn: 40123
>
>
>
> "fea jabi" <zy...@hotmail.com>
> 12/22/2005 09:03 PM
> Please respond to
> "Struts Users Mailing List" <us...@struts.apache.org>
>
>
> To
> user@struts.apache.org
> cc
>
> Subject
> Re: html:multibox with LabelValueBean
>
>
>
>
>
>
> Thanks, Laurie. that worked.
>
> why is JSTL prefered over the logic tags? is there any doc I can read
> about
> the same?
>
> Thanks.
>
>
> >From: Laurie Harper <la...@holoweb.net>
> >Reply-To: "Struts Users Mailing List" <us...@struts.apache.org>
> >To: user@struts.apache.org
> >Subject: Re: html:multibox with LabelValueBean
> >Date: Wed, 21 Dec 2005 16:55:06 -0500
> >
> >fea jabi wrote:
> >>Trying to use html:multibox with LabelValueBean.
> >>
> >>Getting error doing the same.
> >>
> >><form-bean>
> >> <form-property name="Items" type="java.util.ArrayList[]"/>
> >> <form-property name="SelectedItems"
> >>type="java.util.ArrayList[]"/>
> >></form-bean>
> >>
> >>
> >>
> >>In prepare Action
> >>...............
> >>...............
> >>
> >>LabelValueBean lblValueBean1 = new LabelValueBean("Visa1", "V1");
> >>LabelValueBean lblValueBean2 = new LabelValueBean("MasterCard1", "M1");
> >>
> >>
> >> ArrayList misList = new ArrayList();
> >> misList.add(lblValueBean1);
> >> misList.add(lblValueBean2);
> >>
> >> ArrayList selectedList = new ArrayList();
> >> selectedList.add(lblValueBean1);
> >>
> >> form.set("Items", misList);
> >> form.set("SelectedItems", selectedList);
> >>.....................
> >>.
> >>
> >>
> >>In JSP
> >>............
> >>..........
> >><logic:iterate id="item" property="Items">
> >> <html:multibox property="selectedItems">
> >> <bean:write name="item" property="value"/>
> >> </html:multibox>
> >> <bean:write name="item" property="label"/>
> >></logic:iterate>
> >>
> >>
> >>not sure what's wrong in here.
> >
> >For one thing, you've declared your form bean properties to be of type
> >ArrayList[], but you're actually setting them with just ArrayList -- i.e.
>
> >you're declaring an array of lists, but only supplying a single list.
> Don't
> >know if that's the problem but it's definitely odd :-)
> >
> >>Also, would like to know if it's better to use the logicIterate or JSTL
> to
> >>loop thru the items as I am new to JSTL too.
> >
> >In general the JSTL tags should be prefered over the Struts logic tags,
> >though either will work fine in most cases.
> >
> >L.
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >For additional commands, e-mail: user-help@struts.apache.org
> >
>
> _________________________________________________________________
> Express yourself instantly with MSN Messenger! Download today - it's FREE!
>
> http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
>
--
Thanks & RegardsSrinivas732-648-9421(Cell)
Re: html:multibox with LabelValueBean
Posted by Pazhanikanthan Periasamy <Pa...@caritor.com>.
Hello Fea,
I dont think, there are any differences in the way both JSTL and Struts
logic tags work. Fundamentally they both iterate the same input array and
produce the output. Using Logic Iterate tags, you can eliminate many
scriptlet tags that you might end up using when you use JSTL scripts. The
choice is yours as to which to choose.
JSTL is Java standard. Logic Iterate is Struts specific.
Thanks and regards,
Pazhanikanthan. P
Project Leader,
Caritor (India) Pvt. Ltd.,
Madras - 600 006
Mob: 9886152717
Extn: 40123
"fea jabi" <zy...@hotmail.com>
12/22/2005 09:03 PM
Please respond to
"Struts Users Mailing List" <us...@struts.apache.org>
To
user@struts.apache.org
cc
Subject
Re: html:multibox with LabelValueBean
Thanks, Laurie. that worked.
why is JSTL prefered over the logic tags? is there any doc I can read
about
the same?
Thanks.
>From: Laurie Harper <la...@holoweb.net>
>Reply-To: "Struts Users Mailing List" <us...@struts.apache.org>
>To: user@struts.apache.org
>Subject: Re: html:multibox with LabelValueBean
>Date: Wed, 21 Dec 2005 16:55:06 -0500
>
>fea jabi wrote:
>>Trying to use html:multibox with LabelValueBean.
>>
>>Getting error doing the same.
>>
>><form-bean>
>> <form-property name="Items" type="java.util.ArrayList[]"/>
>> <form-property name="SelectedItems"
>>type="java.util.ArrayList[]"/>
>></form-bean>
>>
>>
>>
>>In prepare Action
>>...............
>>...............
>>
>>LabelValueBean lblValueBean1 = new LabelValueBean("Visa1", "V1");
>>LabelValueBean lblValueBean2 = new LabelValueBean("MasterCard1", "M1");
>>
>>
>> ArrayList misList = new ArrayList();
>> misList.add(lblValueBean1);
>> misList.add(lblValueBean2);
>>
>> ArrayList selectedList = new ArrayList();
>> selectedList.add(lblValueBean1);
>>
>> form.set("Items", misList);
>> form.set("SelectedItems", selectedList);
>>.....................
>>.
>>
>>
>>In JSP
>>............
>>..........
>><logic:iterate id="item" property="Items">
>> <html:multibox property="selectedItems">
>> <bean:write name="item" property="value"/>
>> </html:multibox>
>> <bean:write name="item" property="label"/>
>></logic:iterate>
>>
>>
>>not sure what's wrong in here.
>
>For one thing, you've declared your form bean properties to be of type
>ArrayList[], but you're actually setting them with just ArrayList -- i.e.
>you're declaring an array of lists, but only supplying a single list.
Don't
>know if that's the problem but it's definitely odd :-)
>
>>Also, would like to know if it's better to use the logicIterate or JSTL
to
>>loop thru the items as I am new to JSTL too.
>
>In general the JSTL tags should be prefered over the Struts logic tags,
>though either will work fine in most cases.
>
>L.
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org
>
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: html:multibox with LabelValueBean
Posted by fea jabi <zy...@hotmail.com>.
Thanks, Laurie. that worked.
why is JSTL prefered over the logic tags? is there any doc I can read about
the same?
Thanks.
>From: Laurie Harper <la...@holoweb.net>
>Reply-To: "Struts Users Mailing List" <us...@struts.apache.org>
>To: user@struts.apache.org
>Subject: Re: html:multibox with LabelValueBean
>Date: Wed, 21 Dec 2005 16:55:06 -0500
>
>fea jabi wrote:
>>Trying to use html:multibox with LabelValueBean.
>>
>>Getting error doing the same.
>>
>><form-bean>
>> <form-property name="Items" type="java.util.ArrayList[]"/>
>> <form-property name="SelectedItems"
>>type="java.util.ArrayList[]"/>
>></form-bean>
>>
>>
>>
>>In prepare Action
>>...............
>>...............
>>
>>LabelValueBean lblValueBean1 = new LabelValueBean("Visa1", "V1");
>>LabelValueBean lblValueBean2 = new LabelValueBean("MasterCard1", "M1");
>>
>>
>> ArrayList misList = new ArrayList();
>> misList.add(lblValueBean1);
>> misList.add(lblValueBean2);
>>
>> ArrayList selectedList = new ArrayList();
>> selectedList.add(lblValueBean1);
>>
>> form.set("Items", misList);
>> form.set("SelectedItems", selectedList);
>>.....................
>>.
>>
>>
>>In JSP
>>............
>>..........
>><logic:iterate id="item" property="Items">
>> <html:multibox property="selectedItems">
>> <bean:write name="item" property="value"/>
>> </html:multibox>
>> <bean:write name="item" property="label"/>
>></logic:iterate>
>>
>>
>>not sure what's wrong in here.
>
>For one thing, you've declared your form bean properties to be of type
>ArrayList[], but you're actually setting them with just ArrayList -- i.e.
>you're declaring an array of lists, but only supplying a single list. Don't
>know if that's the problem but it's definitely odd :-)
>
>>Also, would like to know if it's better to use the logicIterate or JSTL to
>>loop thru the items as I am new to JSTL too.
>
>In general the JSTL tags should be prefered over the Struts logic tags,
>though either will work fine in most cases.
>
>L.
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org
>
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: html:multibox with LabelValueBean
Posted by Laurie Harper <la...@holoweb.net>.
fea jabi wrote:
> Trying to use html:multibox with LabelValueBean.
>
> Getting error doing the same.
>
> <form-bean>
> <form-property name="Items" type="java.util.ArrayList[]"/>
> <form-property name="SelectedItems" type="java.util.ArrayList[]"/>
> </form-bean>
>
>
>
> In prepare Action
> ...............
> ...............
>
> LabelValueBean lblValueBean1 = new LabelValueBean("Visa1", "V1");
> LabelValueBean lblValueBean2 = new LabelValueBean("MasterCard1", "M1");
>
>
> ArrayList misList = new ArrayList();
> misList.add(lblValueBean1);
> misList.add(lblValueBean2);
>
> ArrayList selectedList = new ArrayList();
> selectedList.add(lblValueBean1);
>
> form.set("Items", misList);
> form.set("SelectedItems", selectedList);
> .....................
> .
>
>
> In JSP
> ............
> ..........
> <logic:iterate id="item" property="Items">
> <html:multibox property="selectedItems">
> <bean:write name="item" property="value"/>
> </html:multibox>
> <bean:write name="item" property="label"/>
> </logic:iterate>
>
>
> not sure what's wrong in here.
For one thing, you've declared your form bean properties to be of type
ArrayList[], but you're actually setting them with just ArrayList --
i.e. you're declaring an array of lists, but only supplying a single
list. Don't know if that's the problem but it's definitely odd :-)
> Also, would like to know if it's better to use the logicIterate or JSTL
> to loop thru the items as I am new to JSTL too.
In general the JSTL tags should be prefered over the Struts logic tags,
though either will work fine in most cases.
L.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org