| Author |
Cannot find bean ... in any scope
|
Albert Mora
Greenhorn
Joined: Feb 14, 2007
Posts: 2
|
|
Hi, i was read the forum for help about struts and logic:iterator, but i have the next problem: sometimes works corretly, and others appears the error: Cannot find bean seguimiento in any scope. The errors appears always in the weblogic log, but sometimes appears the webpage correctly. Thanks, and sorry for my bad english My code: .... FORM: public class ActuMedioambientalForm extends ActionForm implements Serializable { private SeguimientoBean[] seguimientos; public void setSeguimientos(SeguimientoBean[] seguimientos) { this.seguimientos = seguimientos; } public SeguimientoBean[] getSeguimientos() { return seguimientos; } public SeguimientoBean getSeguimiento(int index) { return seguimientos[index]; } public void setSeguimiento(int index, SeguimientoBean seguimiento) { this.seguimientos[index].setFechaPrevista(seguimiento.getFechaPrevista()); this.seguimientos[index].setFechaReal(seguimiento.getFechaReal()); } .... JSP: <logic:iterate indexId="i" name="actuMedioambientalForm" id="seguimiento" property="seguimientos"> <html:text styleClass="caja1" size="10" maxlength="10" name="seguimiento" property="fechaPrevista" indexed="true" /> <html:text styleClass="caja1" size="10" maxlength="10" name="seguimiento" property="fechaReal" indexed="true" /> .... STRUTS-CONFIG: <form-bean name="actuMedioambientalForm" type="es.indra.tram.control.form.actuMedioambiental.ActuMedioambientalForm"/> <action path="/actuMedioambiental" type="es.indra.tram.control.action.actuMedioambiental.ActuMedioambiental" name="actuMedioambientalForm" scope="session" validate="false"> <forward name="cargaAlta" path="........"/> <forward name="seguimiento"path="......"/> </action> .... ACTION: ActuMedioambientalForm actuMedioambientalFrom = (ActuMedioambientalForm) form; SeguimientoBean[] seguimientos = ActuAmbientalesDAO.getSeguimientos(actuMedioambientalFrom.getIdentificador()); String observacion = actuMedioambientalFrom.setSeguimientos(seguimientos); return mapping.findForward("seguimiento");
|
 |
Karthik Krishnamurthy
Ranch Hand
Joined: Feb 04, 2005
Posts: 118
|
|
Hi, I had gone through the same problem. Using logic:iterate to display values will work properly but using it to store will cause the error you have said. There are two ways around this: 1. You can read about indexing in struts (its not as simpl as adding a method with the int index parameter - I learnt this the hard way!) 2. You can read about DynaActionForms here - http://jroller.com/page/charlie.li/20041024 Use DynaActionForm to store your SeguimentioBean[] class and use the c:forEach tag shown there to iterate. Karthik
|
 |
Karthik Krishnamurthy
Ranch Hand
Joined: Feb 04, 2005
Posts: 118
|
|
Hi, You can also read about indexed properties at the following link if you would like to code using just ActionForms http://faq.javaranch.com/view?IndexedProperties Karthik
|
 |
 |
|
|
subject: Cannot find bean ... in any scope
|
|
|