Pierre Henry wrote:

Hi all,

I am trying to use an indexed property following the howto (http://www.apache.org/~sraeburn/maven/faqs/indexedprops.html). I also read many many related mails on this list, but... :(

I have no problem with the getters, but unfortunately, I can not make it work to set the values of the indexed property.

The property is a simple String. The number of them is completely dynamic.

The output of tomcat seems to indicate that the BeanUtils.populate does not "see" my indexed setter. Here is the output :
...
[DEBUG] RequestProcessor - - Populating bean properties from this request
[DEBUG] BeanUtils - -BeanUtils.populate([EMAIL PROTECTED]
f62, {customerCategoryId[2]=[Ljava.lang.String;@1703484, customerPhone=[Ljava.la
ng.String;@187e184, customerCategoryId[0]=[Ljava.lang.String;@1e6cf07, customerL
astName=[Ljava.lang.String;@2209db, customerFirstName=[Ljava.lang.String;@b53b32
, customerAddress=[Ljava.lang.String;@41647f, customerCategoryId[1]=[Ljava.lang.
String;@12cd736, customerEmail=[Ljava.lang.String;@e51bda})
[DEBUG] BeanUtils - -Skipping read-only property
[DEBUG] ConvertUtils - -Convert string 's' to class 'java.lang.String'
[DEBUG] BeanUtils - -Skipping read-only property
[DEBUG] ConvertUtils - -Convert string 's' to class 'java.lang.String'
[DEBUG] ConvertUtils - -Convert string 's' to class 'java.lang.String'
[DEBUG] ConvertUtils - -Convert string 's' to class 'java.lang.String'
[DEBUG] BeanUtils - -Skipping read-only property
[DEBUG] ConvertUtils - -Convert string 's' to class 'java.lang.String'
[DEBUG] RequestProcessor - - Validating input form properties
[DEBUG] RequestProcessor - - Looking for Action instance for class singha.actions.ReservationStep3Action
...


Here is a snippet of my ReservationStep3Form FormBean :
     private ArrayList customerCategoryIds = new ArrayList();
     public void reset(ActionMapping mapping,
             HttpServletRequest request)
   {
     ...
     customerCategoryIds = new ArrayList();
   }

public String getCustomerCategoryId(int index){
System.out.println("getCustomerCategoryId");
if(index < customerCategoryIds.size()) return (String)customerCategoryIds.get(index);
return null;
}
public void setCustomerCategroryId(int index, String value){
if(index >= customerCategoryIds.size()) customerCategoryIds.ensureCapacity(index+1);
customerCategoryIds.set(index, value);
}


Here is the relevant part of the JSP :
I have a list of positions object from the action. I want to add some info to these positons, and in the same form get some infos about the customer (name...).


<html:form action="reservationStep3">
<logic:iterate id="position" name="positions" indexId="index">
<html:select property='<%= "customerCategoryId[" + index + "]" %>' >
<logic:iterate id="price" name="position" property="value">
<html:option value="price.customerCategoryId" style="text-align:right">
<bean:write name="price" property="customerCategory.name" /> -
<bean:write name="price" property="formattedValue"/>
</html:option>
</logic:iterate> </html:select>
</logic:iterate>
//other fields (customer name, address etc...)


This JSP generates the right html like :

<select name="customerCategoryId[0]" >
    <option value="123" >Normal - $14.00</option>
    ...
</select>

DO I have to add something to struts-config ? Or what do I have to do, what do I do wrong ? Any help is really welcome !

Pierre Henry




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


Sorry every body. The problem was only that I wrote setCustomerCategroryId instead of category... and was too tired to even notice that...

Sorry, I hope nobody spent time on this...

Pierre Henry


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



Reply via email to