Looking at your multibox logic, is the 'rol' property in the 'userDataBean' an array of Strings? This should represent the value(s) that the user selects -- so, if the initial setting is all boxes un-checked, this will be an empty String[].
Are you modifying/setting your ArrayList (rolesPossibles) in the reset? I don't see how else it can become null. This list, as you know, represents all the possible checkbox values. I don't know if the above helped. Another source of information is the html-multibox.jsp that is part of the struts-exercise-taglib application that ships with Struts. Sri -----Original Message----- From: M�guel �ngel Mulero Mart�nez [mailto:[EMAIL PROTECTED]] Sent: Monday, November 18, 2002 2:06 AM To: Struts Users Mailing List Subject: RE: ArrayList disappeared in ActionForm Hi all! Thanks to both for your reply. Sorry for my late reply (and my poor english) but in the weekend I can't write to the group. Here some code of my classes (comments are in spanish, sorry): My ActionForm has: ------------------------------------ public class FichaUsuarioActionForm extends ActionForm { .... /** Datos del usuario */ private FichaUsuarioDataBean ficha; /** Roles posibles para situar en el formulario */ private ArrayList rolesPosibles; public FichaUsuarioActionForm() { log.debug("Constructor iniciado"); ficha = new FichaUsuarioDataBean(); log.debug("Constructor finalizado"); } public FichaUsuarioDataBean getUserDataBean() { log.debug("getUserDataBean ejecutado"); return ficha; } public void setUserDataBean(FichaUsuarioDataBean user) { log.debug("setLoginDataBean ejecutado"); ficha = user; } public ArrayList getRolesPosibles() { log.debug("getRolesPosibles ejecutado"); return rolesPosibles; } public void setRolesPosibles(ArrayList _roles) { log.debug("setRolesPosibles ejecutado"); rolesPosibles = _roles; } ..... } ----------- ficha is used to retrieve the values of a HTML form. rolesPosibles is an ArrayList that I must use in the same HTML form (in a multicheck tag). They are private, so I must set its values using the setXXXX function, and this function writes to the log a message. The constructor writes to the log too. In the Action before the HTML form, I use the setRolesPosibles() to put an inicial ArrayList. My HTML form is in the way (login/editarUsuario.jsp): -------------- <html:form action="/modificaUsuarioAction.do" focus="userDataBean.user" enctype="multipart/form-data"> <html:text name="fichaUsuario" property="userDataBean.user" size="60" /> ...... <logic:iterate name="fichaUsuario" property="rolesPosibles" id="elementoListadoRoles"> <html:multibox name="fichaUsuario" property="userDataBean.rol"> <bean:write name="elementoListadoRoles" property="string1"/> </html:multibox> <bean:write name="elementoListadoRoles" property="string2" /><br> </logic:iterate> ...... ------------ So I use the rolesPosibles to put a list of checkbox in my HTML form. The struts-config.xml is like: ----------- .... <form-bean name="fichaUsuario" type="es.mulria.bonsai.login.actionform.FichaUsuarioActionForm"/> .... <action path="/modificaUsuarioAction" type="es.mulria.bonsai.login.action.ModificarUsuariosAction" name="fichaUsuario" input="/login/editarUsuario.jsp" validate="true"> </action> ... ----------- My problem is that if the validate() of the ActionForm has errors, and returns to the HTML form, the ArrayList rolesPosibles has disappear (null), but the ficha not, and has all the values the user puts in the HTML form. The log is like (I only put the ActionForm log): ---------- # The Action before the JSP creates the ActionForm with the ArrayList, and puts it in the request 15 nov 2002 19:25:54,280 [Thread-7] DEBUG es.mulria.bonsai.login.actionform.FichaUsuarioActionForm - Constructor iniciado 15 nov 2002 19:25:54,280 [Thread-7] DEBUG es.mulria.bonsai.login.actionform.FichaUsuarioActionForm - Constructor finalizado 15 nov 2002 19:25:54,340 [Thread-7] DEBUG es.mulria.bonsai.login.actionform.FichaUsuarioActionForm - setRolesPosibles ejecutado .... # Here rolesPosibles has an ArrayList. I can see it if I print it in the log. # Now, the JSP prints all the values in the HTML form (they are in the UserDataBean 15 nov 2002 19:25:54,431 [Thread-7] DEBUG es.mulria.bonsai.login.actionform.FichaUsuarioActionForm - getUserDataBean ejecutado 15 nov 2002 19:25:54,511 [Thread-7] DEBUG es.mulria.bonsai.login.actionform.FichaUsuarioActionForm - getUserDataBean ejecutado .... # To put the list of checkbox in the page, it calls the ArrayList 15 nov 2002 19:25:54,561 [Thread-7] DEBUG es.mulria.bonsai.login.actionform.FichaUsuarioActionForm - getRolesPosibles ejecutado .... # All OK, the ArrayList continues in the ActionForm, and the JSP is displayed. # Now, I submit it. Struts takes the UserDataBean to put the values, the problem is that now, the ArrayList doesn't exist (is null), Without calling the constructor and without calling the setXXXXX (the log don't appear). How can Struts change the ArrayList without calling any of that? Of course, the others functions in the class don't use the ArrayList for nothing. 15 nov 2002 19:26:50,301 [Thread-7] DEBUG es.mulria.bonsai.login.actionform.FichaUsuarioActionForm - getUserDataBean ejecutado ------- So, if the validate has some error and returns to the JSP, it has an error when tries to retrieve the ArrayList of checkbox (null). Some idea? Thanks for read all this (and sorry for my english) Miguel -----Mensaje original----- De: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Enviado el: viernes, 15 de noviembre de 2002 15:48 Para: [EMAIL PROTECTED] Asunto: RE: ArrayList disappeared in ActionForm Hi, I didnt understand your problem very well.But some points U should know. > I use the log4j, and the constructor of the ActionForm isn't called. > The setXXXX for the ArrayList isn't called too. Struts uuses Class.forName() .newInstance() to instantiate new form objects. So the default constructor will be called in this case.So Any lists etc u need to set must Be initialised in the default constructor. -----Original Message----- From: Sri.Sankaran [mailto:[EMAIL PROTECTED]] Sent: Friday, November 15, 2002 3:18 PM To: struts-user Subject: RE: ArrayList disappeared in ActionForm Intermixed... > -----Original Message----- > From: M�guel �ngel Mulero Mart�nez > [mailto:[EMAIL PROTECTED]] > Sent: Friday, November 15, 2002 2:03 AM > To: Lista Struts > Subject: ArrayList disappeared in ActionForm > > > Hi all! I've got a little problem with Struts 1.0.2. > > I've got an ActionForm with two objects: one for save the values of a > HTML form, and an ArrayList with Strings to print in the HTML form. I don't follow. Why do you need separate objects for display and for capture. That is the purpose of the ActionForm. > > The HTML form inits well, reading the values (object and > ArrayList) from the ActionForm created in an Action before. When I > press the submit button, the reset function is called and afterwards > the object is updated with the new values. My problem is that if I > read the ArrayList, it is null. How do the objects in your ActionForm map to your ArrayList. Need to see some code. Send appropriate sections of your JSP, form-bean (ActionForm) and Action class. > > I use the log4j, and the constructor of the ActionForm isn't called. > The setXXXX for the ArrayList isn't called too. > > Where is my ArrayList? Why it's null? > > Thanks to all! > > Miguel > Sri > > > -- > To unsubscribe, e-mail: > <mailto:struts-user-> [EMAIL PROTECTED]> > For > additional commands, > e-mail: <mailto:[EMAIL PROTECTED]> > > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

