Edit: the class should really be:

public class PrimaryKeyIndexedProperty {
    private PrimaryKey[] primaryKeys;

    public PrimaryKeyIndexedProperty(int size) {
        primaryKeys = new PrimaryKey[size];
    }

    public PrimaryKey getIndexedPrimaryKey(int index) {
        return primaryKeys[index];
    }

    public void setIndexedPrimaryKey(int index, PrimaryKey value) {
        primaryKeys[index] = value;
    }
}

and I tried both ways in the JSP:
property="indexedPrimaryKey[index]"
property='<%= "indexedPrimaryKey[" + index + "]" %>'

But still no luck, I'm still getting the error.jsp page.
Any ideas?

-----Original Message-----
From: Justin Mahoney 
Sent: Friday, October 03, 2003 4:57 PM
To: 'Struts Users Mailing List'
Subject: RE: Using logic:iterate with twin Collections


I tried changing the property attribute as suggested, but no luck. I'm just
being forwarded to the global error page with no stack trace when it tries
to execute the JSP (in either case).
Is this an appropriate class for the keyFields property?:

public class PrimaryKeyIndexedProperty {
    private PrimaryKey[] primaryKeys;

    public PrimaryKeyIndexedProperty(int size) {
        primaryKeys = new PrimaryKey[size];
    }

    public PrimaryKey getIndexed(int index) {
        return primaryKeys[index];
    }

    public void setIndexed(int index, PrimaryKey value) {
        primaryKeys[index] = value;
    }
}

Thanks,
Justin

-----Original Message-----
From: Karr, David [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 01, 2003 2:43 PM
To: Struts Users Mailing List
Subject: RE: Using logic:iterate with twin Collections


Try changing your "property" attribute to the following:
  '<%= "keyFields[" + index + "]" %>'

This is assuming you really do have an indexed property setter for the
"keyFields" property.

> -----Original Message-----
> From: Justin Mahoney [mailto:[EMAIL PROTECTED] 
> 
> Thanks David,
> I tried doing that, along the following lines:
> 
>       <html:link page="details.jsp" name="<%= Action.KEYS %>"
> property="keyFields[index]">
> 
> But I get:
> <Oct 1, 2003 2:23:40 PM PDT> <Error> <HTTP>
> <[WebAppServletContext(3016177,mywebapp,/mywebapp)] Root cause of
> ServletException
> java.lang.IllegalArgumentException: Invalid indexed property
> 'keyFields[index]'
> -----Original Message-----
> From: Karr, David [mailto:[EMAIL PROTECTED]
> 
> You'll have to use the "indexId" attribute to allow you to 
> reference the
> index value, and then directly reference the entry of the other
> collection using that value.
> 
> > -----Original Message-----
> > From: Justin Mahoney [mailto:[EMAIL PROTECTED] 
> > 
> > Hi,
> > I have two Collections (ArrayLists) with an equal number of 
> > elements that
> > are directly related to each other, but the child elements have no
> > references to each other. How can I use the logic:iterate tag 
> > to iterate
> > over the first and pull out the corresponding element from 
> > the other for use
> > in the html:link tag?
> > Specifically, the second Collection is an ArrayList of Maps for the
> > html:link tag's use with the 'property' attribute.
> > Thanks,
> > Justin
> > 
> 
> ---------------------------------------------------------------------
> 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