array of classes in DynaValidatorForm


General J2EE: array of classes in DynaValidatorForm

  1. array of classes in DynaValidatorForm (1 messages)

    Hi all,

    I have a DynaValidatorForm(dynaForm1) with two String properties and
    one array of classes(Khd1[]) from a <input name="q1"> in iterate.
    In app1.jsp first I get list of
    objects(qList) with "Khd1" type from 3 tables, it returns correct values,
    and In address1,address2 have correct values
    and array of class of form is not empty but each property of each object
     is null(like ((Khd1)q[0]).getQid())).
    I don't know is this way correct to bind dynaForm1 to properties in
    <logic:iterate id="q" name="qList" scope="request" type="general.Khd1" >
    , does anyone know why objects have no values.

    Thanks in advance.

            type="java.lang.String" />

            type="java.lang.String" />

            type="general.Khd1[]" size="4" />

               <forward name="success2" path="/pages/app2.jsp" />
               <forward name="success1" path="/pages/app1.jsp" />


     public ActionForward reCalculate(ActionMapping mapping,
              ActionForm form,
              HttpServletRequest request,
              HttpServletResponse response)
              throws IOException, ServletException {

    DynaValidatorForm dynaFrm= (DynaValidatorForm) form ;
            Khd1[] q = (Khd1[])dynaFrm.get("khd") ;

    if(q==null) // q is not null.
    System.out.println("q is null");

         System.out.println((String)dynaFrm.get("address2")) ;// it returns correct value.

    System.out.println((Long)(((Khd1)q[0]).getQid()));//print null

          return mapping.findForward("success1");


    List qList = UserService.getInstance().getQList (username);
    request.setAttribute("qList", qList);

     <logic:iterate id="q" name="qList" scope="request" type="general.Khd1" >

    <html:hidden name="q" property="qid"/>

    <td><bean:write name="q" property="product_id" /></TD>
    <td><bean:write name="q" property="name" /></TD>
    <input name="q1" value="<bean:write name="q" property="q"/>" size="20" ></TD>

    <td><bean:write name="q" property="price" /></TD>

    <TR>Address 1</TD><TD ><INPUT size=50 name=address1 value="<bean:write name="user" property="address_1" />" > </TD></TR>
    <TR>Address 2</TD><TD ><INPUT size=50 name=address2 value="<bean:write name="user" property="address_2" />" > </TD></TR>
  2. Hi all,

    also it makes no different with DaynaActionForm
    Please help if you know somthing useful.