You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Kevin Wang <KW...@Partnerware.com> on 2000/10/26 02:58:40 UTC

Link tag inside Iterate or Enumerate tag

I'm trying to use the <link> inside <enumerate> as follows,

<struts:enumerate id="org" name="companies">
	  <struts:link href="org.do?action=view" name="org"
property="primaryKey">
	  <struts:htmlProperty name="org" property="name"/>
	  </struts:link>
        ....
	  <struts:htmlProperty name="org" property="contact"/>
</struts:enumerate>

the <link> can't get property for 'primaryKey' when 'companies' is an Array
but works fine is 'companies' is an Enumeration. <htmlProperty> works well
in both cases. 

Any work arround is appreciated.

Thanks.
Kevin

-----Original Message-----
From: Pierre Delisle [mailto:pierre.delisle@sun.com]
Sent: Wednesday, October 25, 2000 7:08 PM
To: struts-user@jakarta.apache.org
Subject: Re: getting arrays w/ useBean?


Seth,

Simply add the scope attribute and it should then work.

 <jsp:useBean id="id" class="my.class[]" scope="request"/>

     -- Pierre

Seth Ladd wrote:
> 
> Hello,
> 
> I'm having a problem with referencing an array with <jsp:useBean>.  I keep
> getting ClassCastExceptions, and I'm not sure how exactly to do this.
> 
> I gave the request an array of objects using request.setAttribute("id",
> myArray).  When I reference this in my JSP page, I am trying to use
> something like:
> 
> <jsp:useBean id="id" class="my.class[]">
> 
> but it doesn't work.  I have also tried different permutations of class
and
> type using brackets or not.  The goal is to get an array, from the request
> object to the <struts:iterate> taglib (which is really cool, btw!).
> 
> If anyone can help me out, I would really appreciate it.
> 
> Thanks very much in advance,
> Seth
> 
> ps I eventually just didn't use <jsp:useBean> and referenced the array
> directly with iterate, but now I'm really curious how to do it. :)

signoff struts-USER

Posted by Michael levin <mi...@cambridgeweb.ie>.
signoff struts-USER

Michael Levin,
mike@cambridgeweb.ie

::: phone/fax (US) ::: 407 622 WEBS (9327)
::: mobile (US) ::: 321 277-8955
::: toll-free phone (US) ::: 877 536 7979 ext 212
::: phone/fax (Ireland) ::: 01 633 5606








----- Original Message -----
From: "Kevin Wang" <KW...@Partnerware.com>
To: <st...@jakarta.apache.org>
Sent: Wednesday, October 25, 2000 8:58 PM
Subject: Link tag inside Iterate or Enumerate tag


> I'm trying to use the <link> inside <enumerate> as follows,
>
> <struts:enumerate id="org" name="companies">
>   <struts:link href="org.do?action=view" name="org"
> property="primaryKey">
>   <struts:htmlProperty name="org" property="name"/>
>   </struts:link>
>         ....
>   <struts:htmlProperty name="org" property="contact"/>
> </struts:enumerate>
>
> the <link> can't get property for 'primaryKey' when 'companies' is an
Array
> but works fine is 'companies' is an Enumeration. <htmlProperty> works well
> in both cases.
>
> Any work arround is appreciated.
>
> Thanks.
> Kevin
>
> -----Original Message-----
> From: Pierre Delisle [mailto:pierre.delisle@sun.com]
> Sent: Wednesday, October 25, 2000 7:08 PM
> To: struts-user@jakarta.apache.org
> Subject: Re: getting arrays w/ useBean?
>
>
> Seth,
>
> Simply add the scope attribute and it should then work.
>
>  <jsp:useBean id="id" class="my.class[]" scope="request"/>
>
>      -- Pierre
>
> Seth Ladd wrote:
> >
> > Hello,
> >
> > I'm having a problem with referencing an array with <jsp:useBean>.  I
keep
> > getting ClassCastExceptions, and I'm not sure how exactly to do this.
> >
> > I gave the request an array of objects using request.setAttribute("id",
> > myArray).  When I reference this in my JSP page, I am trying to use
> > something like:
> >
> > <jsp:useBean id="id" class="my.class[]">
> >
> > but it doesn't work.  I have also tried different permutations of class
> and
> > type using brackets or not.  The goal is to get an array, from the
request
> > object to the <struts:iterate> taglib (which is really cool, btw!).
> >
> > If anyone can help me out, I would really appreciate it.
> >
> > Thanks very much in advance,
> > Seth
> >
> > ps I eventually just didn't use <jsp:useBean> and referenced the array
> > directly with iterate, but now I'm really curious how to do it. :)
>