The following comment has been added to this issue:

     Author: Nathan Egge
    Created: Wed, 27 Apr 2005 6:58 PM
       Body:
It turns out that my solution to this problem is too simple minded.  For 
example, if you had a member variable that was a Long, you could not just do:

  protected Long id=new Long();

since a Long does not have a default constructor.  What would be better, would 
be to have member variable tags like @struts.form-variable and the line that 
contains the variable would be copied over.  I don't know how difficult that 
would be to do, but it would allow you to then allow for default constructors 
on only those member variables that need them (e.g., Lists, Maps, etc.)

In addition, it would allow you to preserve the notion of transient member 
variables into the Form bean.  This would be nice for use with utilities like 
ToStringBuilder, HashCodeBuilder, etc.

Thoughts?
---------------------------------------------------------------------
View this comment:
  
http://opensource.atlassian.com/projects/xdoclet/browse/XDT-1367?page=comments#action_16465

---------------------------------------------------------------------
View the issue:
  http://opensource.atlassian.com/projects/xdoclet/browse/XDT-1367

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: XDT-1367
    Summary: Uninitialized "subform" objects from @struts.form
       Type: Bug

     Status: Open
   Priority: Major

 Original Estimate: Unknown
 Time Spent: Unknown
  Remaining: Unknown

    Project: XDoclet
 Components: 
             Apache Module
   Versions:
             1.2.3

   Assignee: xdoclet-devel (Use for new issues)
   Reporter: Nathan Egge

    Created: Wed, 27 Apr 2005 3:33 PM
    Updated: Wed, 27 Apr 2005 6:58 PM
Environment: Gentoo Linux x86/2005.0/2.4
[blackdown-jdk-1.4.2] "Blackdown JDK 1.4.2"

Description:
When generating Form objects from POJOs with the @struts.form 
include-all="true", the Form object it creates leaves all the attributes 
uninitialized.  If my POJO contains another POJO, the resulting generated form 
has a "subform" that is not initalized in the form.  

If I have the following jsp code that renders a select based on the id of a 
"subform" called type,

<html:select property="type.id">
  <html:options collection="types" property="id" labelProperty="name"/>
</html:select>

when I submit this form I get the following exception:

java.lang.IllegalArgumentException: No bean specified
at 
org.apache.commons.beanutils.PropertyUtils.getPropertyDescriptor(PropertyUtils.java:837)
at org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:934)
at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808)
at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:495)
at 
org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:798)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:205)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
...

This is because the all of the non-primative types in the Form are left 
uninitialized.  The correct behaviour would be to create a new object for each 
member variable.


---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://opensource.atlassian.com/projects/xdoclet/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira



-------------------------------------------------------
SF.Net email is sponsored by: Tell us your software development plans!
Take this survey and enter to win a one-year sub to SourceForge.net
Plus IDC's 2005 look-ahead and a copy of this survey
Click here to start!  http://www.idcswdc.com/cgi-bin/survey?id=105hix
_______________________________________________
xdoclet-devel mailing list
xdoclet-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel

Reply via email to