Hi Rick

Thanks again for the quick replies.

Ok, basically I have a DTO called VaribleTo which has name, dataType and
value attributes. Then I define my dynamic form bean:

    <form-bean name="formulaForm" type="package.FormulaForm" dynamic="true">
      <form-property name="variables" type="package.VariableTo[]"/>
    </form-bean> 

Ok and I'm displaying the content using the struts tags:

<c:forEach items="${formulaForm.map.variables}" var="variables">
<html:text indexed="true" name="variables" property="name"/>
<html:text indexed="true" name="variables" property="dataType"/>
<html:text indexed="true" name="variables" property="value"/>
</c:forEach>
<input name="button" type="submit" value="Refresh"/>

This works fine. I can load the variables attribute in an action class and
it gets loaded on the JSP.

I added the reset method to the FormulaForm class:

public class FormulaForm extends DynaActionForm 
{
  public FormulaForm()
  {
  }

  public void reset (ActionMapping mapping, HttpServletRequest request)
  {
    Enumeration enum  = request.getParameterNames ();
    String      name;
    int         count = 0;
    
    while (enum.hasMoreElements ())
    {
      name = (String) enum.nextElement ();
      if (name.startsWith ("variables") && name.endsWith ("name")) count++;
    }
    
    set ("variables", new VariableTo [count]);
  }
}

Now the first time I call the JSP it works fine. I have a refresh button
that refreshes the page. The reset method is called with no problems and
then I get the exception java.lang.IllegalArgumentException: No bean
specified. Now I did some test using session scope and it seems that if I
put the reset method I also get the exception. There is something in the set
("variables", new VariableTo [count]) method that Struts doesn't like.

Regards,

Néstor Boscán
 
-----Mensaje original-----
De: Rick Reumann [mailto:[EMAIL PROTECTED] 
Enviado el: Wednesday, January 18, 2006 11:21 AM
Para: Struts Users Mailing List
Asunto: Re: RV: Array of a java bean and Dynamic Form Beans

Néstor Boscán wrote the following on 1/18/2006 10:05 AM:
> Hi Rick
> 
> If I comment the reset method I get:
> 
> java.lang.ArrayIndexOutOfBoundsException: 0   at

I'm assuming you get that when you submit your form? Some of these things
have to be broken down into baby stteps since sometimes the error you think
you are getting is related to something else, that is why I want to make
sure you are at least first getting to the form and having it display
correctly first. Post the snippets of source code that I mentioned in the
last post.


--
Rick

---------------------------------------------------------------------
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