struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Francisco Exposito Aguilera" <>
Subject Re: html:optionsCollection problem
Date Tue, 01 Aug 2006 16:27:18 GMT
I´ve added it into a <html:form action=""> but I obtain the 

Cannot create iterator for project.struts.General.Prueba@3fc47c

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()
	public void setEmpresas(String empresa)

<jsp:useBean id="test" class="project.struts.General.Prueba"/>
    <html:select property="rempresa">
    <html:options collection="test" property="nifempresa"/>

I don´t know if I have explained my issue as I should.

Thanks a lot.

>From: Monkeyden <>
>Reply-To: "Struts Users Mailing List" <>
>To: "Struts Users Mailing List" <>
>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 <> wrote:
>>I have a Bean:
>>package project.struts.General;
>>import java.util.ArrayList;
>>import java.util.Collection;
>>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"/>
>>But it doesn't work. I receive the error
>>javax.servlet.ServletException: Cannot find bean under name
>>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
>>& Amistad.
>>To unsubscribe, e-mail:
>>For additional commands, e-mail:

Horóscopo, tarot, numerología... Escucha lo que te dicen los astros.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message