You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Haertfelder, Michael" <Mi...@Dresdner-Bank.com> on 2004/09/09 11:59:07 UTC

Problem getting content of indexed fields

I have problems retrieving the content of entry fields generated by a JSP
iterator:

In my JSP page I declared an iterator and multiple html:text fileds similar
to:

    <logic:iterate id="currList" name="borrDM" property="rentDetails"
type="dreba.prj.ikr.ika.borroweranalysis.model.vo.xxxVo">
         ...
         <tr> 
             <td class="general"><html:text name="currList"
property="riskCapital"       
                                            size="10" value="<%=
myFormatter.getRiskCapital() %>"  indexed="true" /></td>
   		     <td class="general"><html:text name="currList"
property="expectedLoss"      
                                            size="10" value="<%=
myFormatter.getExpectedLoss() %>"  indexed="true" /></td>
  		     <td class="general"><html:text name="currList"
property="EVAAbsolut"        
                                            size="10" value="<%=
myFormatter.getEVAAbsolut() %>" indexed="true" /></td>
         ....
        </tr>
   </logic:iterate>

The resulting source code of the displayed html page looks like (as
expected):

       ....
       <td class="general"><input type="text" name="currList[0].riskCapital"
size="10" value="4.444.444"></td>
   	 <td class="general"><input type="text"
name="currList[0].expectedLoss" size="10" value="20.500.700"></td>
  	 <td class="general"><input type="text"
name="currList[0].EVAAbsolut" size="10" value="777.777"></td>
       ....
       <td class="general"><input type="text" name="currList[1].riskCapital"
size="10" value="1.111.111"></td>
   	 <td class="general"><input type="text"
name="currList[1].expectedLoss" size="10" value="10.566.900"></td>
  	 <td class="general"><input type="text"
name="currList[1].EVAAbsolut" size="10" value="232.323"></td>
       ...

According to some recommendations I declared in the struts-config.xml:

	 <form-bean name="ba_xxxForm"
type="org.apache.struts.action.DynaActionForm">
	    <form-property name="targetAction" type="java.lang.String" />
	    <form-property name="dispatch" type="java.lang.String" />
	    <form-property ... />
          .....
	    <form-property name="currList" type="java.lang.String[]"/>

	 </form-bean>

When I tried to enter this code WebSphere noticed an error and informs me
that there is

"invalid data for attribute "type" in part currList type form property"

Other alternatives show similar errors. E.g.

	    <form-property name="currList[0].riskCapital"
type="java.lang.String"/>

yields:

"invalid data for attribute "name" in part currList[0].riskCapital type form
property"

So how should I declare the form-property in order to be able to retrieve
the data from the page?
Retrieving values from other entry fields (which are not part of an
interator loop) on the page work fine
as well as filling the entry fields with initial values.

Later (after having declared the form-property successfully) I planned to
get the current field values
from the DispatchAction by 

          String val;
     	    xxxVo[] myarr = (xxxVo[]) df.get("currList");
	    for (int i = 0; i < myarr.length; i++) {
	      val = myarr[i].getRiskCapital();
            ...   }
                   
Does soemone know a solution for this problem?

Thx
Michael Haertfelder

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org