You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by harriquitawn tawn tawn <ha...@hotmail.com> on 2006/09/25 16:01:44 UTC

Error loading Collection in form

Hi all,

In the jsp page "ProjectsFound.jsp" I obtain the list of all projects in a 
DB and I have two bottoms (edit and add groups).
If I click on Add Groups, I want to show in the new page (addGroups.jsp) the 
name of the project and a list of all groups
in order to select all which I want to link (I have a many-to-many relation 
in the DB).

I get the name of the project without problem with the line:

<input type="text" name="name" value="<bean:write name="activeProject" 
property="name"/>"/>

but when I want to show all rows of table group,

<logic:iterate name="listAllGroups" id="group">
	<bean:write name="group" property="idGroup"/>
</logic:iterate>

where listAllGroups is a Collection saved in session:
	GroupBean bgb = new GroupBean(getDataSource(request,"project"));
	Collection groups = bgb.getAllGroups();
	session.setAttribute("listAllGroups",groups);

I get the error:

org.apache.jasper.JasperException
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:370)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1062)
	org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:386)
	org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:229)
	org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
	org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
java.lang.NullPointerException
	org.apache.commons.beanutils.PropertyUtilsBean.getSimpleProperty(PropertyUtilsBean.java:1109)
	org.apache.commons.beanutils.PropertyUtilsBean.getNestedProperty(PropertyUtilsBean.java:686)
	org.apache.commons.beanutils.PropertyUtilsBean.getProperty(PropertyUtilsBean.java:715)
	org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.java:290)
	org.apache.struts.taglib.TagUtils.lookup(TagUtils.java:950)
	org.apache.struts.taglib.bean.WriteTag.doStartTag(WriteTag.java:225)
	org.apache.jsp.Menus.Admin.agregarGruposAProyecto_jsp._jspx_meth_bean_write_2(org.apache.jsp.Menus.Admin.agregarGruposAProyecto_jsp:446)
	org.apache.jsp.Menus.Admin.agregarGruposAProyecto_jsp._jspService(org.apache.jsp.Menus.Admin.agregarGruposAProyecto_jsp:199)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1062)
	org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:386)
	org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:229)
	org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
	org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


In my struts-config.xml file I have:

<form-bean name="addGroupToProjectForm" 
type="org.apache.struts.validator.DynaValidatorForm">
   <form-property name="idProject" type="java.lang.String"/>
   <form-property name="name" type="java.lang.String"/>
   <form-property name="idGroup" type="java.util.String"/>
  </form-bean>

<action
   name="addGroupToProjectForm" parameter="accion" path="/addGroupToProject"
   scope="request" type="project.struts.Actions.Admin.ProjectAction" 
validate="false">
   <forward name="addGroups" path="/Menus/Admin/viewDataProject.jsp"/>
   <forward name="notAddGroups" path="/Menus/Admin/error.jsp"/>
  </action>

Could anyone help me?

Thanks a lot.

_________________________________________________________________
¿Estás pensando en cambiar de coche? Todas los modelos de serie y extras en 
MSN Motor. http://motor.msn.es/researchcentre/


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Error loading Collection in form

Posted by Francisco Exposito Aguilera <fc...@hotmail.com>.
Hi, I've solved the issue this morning. My DTOGroup.java was not correctly 
defined. I had

public class DTOGroups extends DynaValidatorForm implements Serialize

and the extends DynaValidatorForm is not correct -obvious.... I don't 
remember to put it there :)




>From: "Thomas Joseph" <th...@kottsoftware.com>
>Reply-To: "Struts Users Mailing List" <us...@struts.apache.org>
>To: "Struts Users Mailing List" <us...@struts.apache.org>
>Subject: Re: Error loading Collection in form
>Date: Tue, 26 Sep 2006 17:02:22 +0530
>
>Hi,
>
>----- Original Message -----
>From: "harriquitawn tawn tawn" <ha...@hotmail.com>
>To: <us...@struts.apache.org>
>Sent: Monday, September 25, 2006 7:31 PM
>Subject: Error loading Collection in form
>
> >
> > I get the name of the project without problem with the line:
> >
> > <input type="text" name="name" value="<bean:write name="activeProject"
> > property="name"/>"/>
> >
> > but when I want to show all rows of table group,
> >
> > <logic:iterate name="listAllGroups" id="group">
> > <bean:write name="group" property="idGroup"/>
> > </logic:iterate>
> >
> > where listAllGroups is a Collection saved in session:
> > GroupBean bgb = new GroupBean(getDataSource(request,"project"));
> > Collection groups = bgb.getAllGroups();
> > session.setAttribute("listAllGroups",groups);
> >
> > I get the error:
> >
>
>
>Not sure how you are you populating your collection..
>
>Please check on that. viz, the method - getAllGroups();
>
>please post with the code snippet if you still get the error.
>
>
>Thanks and Regards,
>Thomas Joseph
>Kott Software Pvt. Ltd. | Vallamattom Estate | M.G.Road | Cochin, Kerala -
>682015 | India
>www.kottsoftware.com
>----------------------------------------------------------------------------
>----
>This email (including any attachments) is subject to copyright, the
>information in it is confidential, and it is legally privileged. Use of 
>this
>email or of any information in it other than by the addressee is
>unauthorized and unlawful. If you are not the intended recipient of the
>mail, kindly notify the author of the mail and delete the
>same. 
>----------------------------------------------------------------------
>----------
>It doesn't matter how you were, but rather how you are that decides your
>future. A right attitude will get you to Success.
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org
>

_________________________________________________________________
Horóscopo, tarot, numerología... Escucha lo que te dicen los astros. 
http://astrocentro.msn.es/


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Error loading Collection in form

Posted by Thomas Joseph <th...@kottsoftware.com>.
Hi,

----- Original Message -----
From: "harriquitawn tawn tawn" <ha...@hotmail.com>
To: <us...@struts.apache.org>
Sent: Monday, September 25, 2006 7:31 PM
Subject: Error loading Collection in form

>
> I get the name of the project without problem with the line:
>
> <input type="text" name="name" value="<bean:write name="activeProject"
> property="name"/>"/>
>
> but when I want to show all rows of table group,
>
> <logic:iterate name="listAllGroups" id="group">
> <bean:write name="group" property="idGroup"/>
> </logic:iterate>
>
> where listAllGroups is a Collection saved in session:
> GroupBean bgb = new GroupBean(getDataSource(request,"project"));
> Collection groups = bgb.getAllGroups();
> session.setAttribute("listAllGroups",groups);
>
> I get the error:
>


Not sure how you are you populating your collection..

Please check on that. viz, the method - getAllGroups();

please post with the code snippet if you still get the error.


Thanks and Regards,
Thomas Joseph
Kott Software Pvt. Ltd. | Vallamattom Estate | M.G.Road | Cochin, Kerala -
682015 | India
www.kottsoftware.com
----------------------------------------------------------------------------
----
This email (including any attachments) is subject to copyright, the
information in it is confidential, and it is legally privileged. Use of this
email or of any information in it other than by the addressee is
unauthorized and unlawful. If you are not the intended recipient of the
mail, kindly notify the author of the mail and delete the
same. ----------------------------------------------------------------------
----------
It doesn't matter how you were, but rather how you are that decides your
future. A right attitude will get you to Success.



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org