u put the collection empresas in the request or session, try both i think .
2006/8/1, Romu <[EMAIL PROTECTED]>:
<html:select name="nameForm" property="pays" > <html:options collection="empresas" property="value" labelProperty="label"/> </html:select> where pays is the property of your form 2006/8/1, Francisco Exposito Aguilera <[EMAIL PROTECTED]>: > I´ve added it into a <html:form action="nameaction.do"> but I obtain the > error > > Cannot create iterator for [EMAIL PROTECTED] > > I´ve modified some code because I want to obtain a select with all info > of a > table which is placed in a database when the page is loaded; and this > page > only comes from a link, not from another page with an associated action > (therefore, nothing has been saved in session). > > public class Prueba implements Serializable > { > private Collection empresas=new ArrayList(); > DTOEmpresa empresa = new DTOEmpresa(); > > public Collection getEmpresas() > { > empresa.setNifEmpresa("A11111111"); > empresas.add(empresa); > return(empresas); > } > public void setEmpresas(String empresa) > { > empresas.add(empresa); > } > } > > <jsp:useBean id="test" class="project.struts.General.Prueba"/> > <html:select property="rempresa"> > <html:options collection="test" property="nifempresa"/> > </html:select> > > > I don´t know if I have explained my issue as I should. > > Thanks a lot. > > > > >From: Monkeyden <[EMAIL PROTECTED]> > >Reply-To: "Struts Users Mailing List" < user@struts.apache.org> > >To: "Struts Users Mailing List" <user@struts.apache.org> > >Subject: Re: html:optionsCollection problem > >Date: Tue, 1 Aug 2006 11:13:36 -0400 > > > >Looks like it may not be wrapped in a <html:form> tag in your JSP. You > >probably also want a field named "toSelect", with accessor and mutators > in > >your form bean, to hold the selected value. > > > >On 8/1/06, Francisco Exposito Aguilera <[EMAIL PROTECTED]> wrote: > >> > >>Hi, > >> > >>I have a Bean: > >> > >>package project.struts.General; > >>import java.util.ArrayList; > >>import java.util.Collection; > >>import java.io.*; > >> > >>public class Prueba implements Serializable > >>{ > >> private Collection empresas=new ArrayList(); > >> > >> public Collection getEmpresas() > >> { > >> empresas.add("string1"); > >> empresas.add("string2"); > >> return(empresas); > >> } > >>} > >> > >>and a jsp where I write: > >> > >><jsp:useBean id="test" class=" project.struts.General.Prueba" /> > >><html:select property="toSelect"> > >> <html:optionsCollection property="empresas" name="test"/> > >></html:select> > >> > >>But it doesn't work. I receive the error > >>javax.servlet.ServletException: Cannot find bean under name > >>org.apache.struts.taglib.html.BEAN > >> > >>How can I solve this issue? Or what is the correct way to generate > this? > >> > >>Thanks in advance > >> > >>_________________________________________________________________ > >>Un amor, una aventura, compañía para un viaje. Regístrate gratis en > MSN > >>Amor > >>& Amistad. http://match.msn.es/match/mt.cfm?pg=channel&tcid=162349 > >> > >> > >>--------------------------------------------------------------------- > >>To unsubscribe, e-mail: [EMAIL PROTECTED] > >>For additional commands, e-mail: [EMAIL PROTECTED] > >> > >> > > _________________________________________________________________ > Horóscopo, tarot, numerología... Escucha lo que te dicen los astros. > http://astrocentro.msn.es/ > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >