Here's the stuff that's working with an Array property.

                <logic:iterate id="predicate" name="AdvancedQueryForm"
                        property="predicates" indexId="index">
                <tr>
                        <td class="checkbox">
                                <html:checkbox property='<%="predicates[" +
index + "].enabled"%>'/>
                        </td>
                        <td class="predicate">
                                <html:select property='<%="predicates[" +
index + "].displayTag"%>'>
                                        <html:options
property="fieldNames"/>
                                </html:select>
                        </td>
                        <td class="op">
                                <html:select property='<%="predicates[" +
index + "].op"%>'>
                                        <html:options
property='<%="predicates[" + index + "].ops"%>'/>
                                </html:select>
                        </td>
                        <td class="value">
                                <html:text size="40" 
                                        property='<%="predicates[" + index +
"].value"%>'/>
                        </td>
                        <td class="action">
                                <html:image property="resetbutton"
src="images/rowinsertbefore.gif" 
                                        alt="Insert before." 
                                        onclick='<%="rowInsertBefore( " +
index + " )"%>'/>
                         </td>
                        <td class="action">
                                <html:image property="resetbutton"
src="images/rowinsertafter.gif" 
                                        alt="Insert after."/>
                         </td>
                        <td class="action">
                                <html:image property="resetbutton"
src="images/rowdelete.gif" 
                                        alt="Delete."/>
                         </td>
                </tr>
                </logic:iterate> 

Here's my propery access

        /**     Get search predicates. 
         *      @return Predicate [] search predicates. */
        public Predicate [] getPredicates() { return predicates; }

   /**  Set criteria.
    *           @param list criteria list. */
        public void setPredicates(Predicate [] predicates) 
                { System.out.println("SETTING PREDICATES"); this.predicates
= predicates; }

And my reset

        /**     Reset all properties to their default values.
         *      @param mapping The mapping used to select this instance.
         *      @param request The servlet request we are processing. */
        public void reset(ActionMapping mapping, HttpServletRequest request)
{
                System.out.println("RESET!!!!");
                action = "";
                profileNames = new String[0];
                currentPredicate = 0;
                predicateCount = 1;
                predicates = new Predicate[predicateCount];
                predicates[0] = new Predicate();
                type = "";
                includeLockedLoans = false;
        }

The problem with this approach seems to be that one submit my Array size
gets defaulted (to one) and then populated so modifying the Array size
dynamically seems difficult.


-----Original Message-----
From: John Espey [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 12, 2003 11:25 AM
To: Struts Users Mailing List
Subject: RE: 1.0.2 with Collection property


Can you post a snippet from your JSP?

> -----Original Message-----
> From: Clement, Stephen [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, February 12, 2003 10:19 AM
> To: [EMAIL PROTECTED]
> Subject: 1.0.2 with Collection property
>
>
>
> Is it me or does the logic:iterate tag with a Collection property not work
> in 1.0.2 in such a way as to populate my page and properly submit my form
> class?  I have struggle somewhat with this lately.
>
> I can make it work with bean:write's but then changes to my pages won't
> populate my form class on submit.
>
> I have gotten it to work using an Array of Objects instead of a Collection
> but I can't seem modify the size of the Array because the reset
> function for
> the form always sets it to a default size (one in this case).
>
> So...what's the best and easiest way to have a bean property that is an
> Array (or Collection) that I can add to or remove from
> interactively from my
> page?
>
> Thanks,
>
> Steve
>
> ---------------------------------------------------------------------
> 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]

Reply via email to