Hi all,
In a jsp file i need to iterate over an ArrayList of javabean :

The bean:

public class myBean implements java.io.Serializable{
        private Integer code;
        private String name;
        
        public Integer getCode(){return code;}
        public String getName(){return name;}
        
        public void setCode(Integer val){ code=val;}
        public void setName(String val){ name=val;}
        
}

In the action class i set the form.list variable:
...
public ActionForward list(
                ActionMapping mapping,
                ActionForm form,
                HttpServletRequest request,
                HttpServletResponse response)
                throws IOException, ServletException {
                                try {
                                        myBean[] l;
                                        l=getMyBeanArray();
                                        ((ActionFormBase)form).list=new
ArrayList();
                                        for (int i=0;i<l.length;i++){
        
((ActionFormBase)form).lista.add(l);    
                                        }
                                        request.setAttribute("lista",
((ActionFormBase)form).lista);
                                } catch (Exception e){
        
((ActionFormBase)form).ErrMessage=e.getMessage() ;
                                }
                        return(mapping.getInputForward() );
}
...
And this is my jsp code:
...
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
...
<logic:iterate id="index" name="lista" type="myBean">
        <bean:write name="index" property="code"/>
        <bean:write name="index" property="name"/>
</logic:iterate>

But what i get is an Exception:
java.lang.ClassCastException: [LmyBean;

Any help will be greatly appreciated.
Thanks in advance

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to