You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2006/02/17 00:42:55 UTC

DO NOT REPLY [Bug 38689] New: - nested properties on beans fetched from a list do not get populated

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38689>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38689

           Summary: nested properties on beans fetched from a list do not
                    get populated
           Product: Commons
           Version: 1.6 Final
          Platform: Other
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Bean Utilities
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: rouadec@hotmail.com


Here is some struts tags : 
 <ul class="details">
    <nested:iterate property="links" >
      <li>
        <nested:text property="test"/>
        <nested:text property="link.priority"/>
      </li>
    </nested:iterate>
  </ul>

this render a list of objects, each with a "test" string property and a "link"
bean object with a "priority" property. I am in the context of a struts form so
the root bean is my ActionForm (I'm using a LazyValidatorForm)

I set the data in the form with :

List<ClipCategoryLinkCompoundEntity> links = /*get the list*/;
form.set("links", links);

this does not work, meaning the page does get rendered correctly but when
submitted the call on line
http://jakarta.apache.org/commons/beanutils/xref/org/apache/commons/beanutils/BeanUtilsBean.html#901
returns a null bean when trying to populate the priority property. Bean not
specified error get throw somewhere latter.

this works fine if you remove the <nested:text property="link.priority"/> tag
though, which led me to think this might a bug and not a misconfiguration.

here a trace of the DEBUG level output:

for the test field :

2006-02-17 12:25:53,796 DEBUG [org.apache.commons.beanutils.BeanUtils]  
setProperty(nz.web.form.BaseDynaForm@5c4833, links[0].test, [raaaah])
2006-02-17 12:25:53,796 DEBUG [org.apache.commons.beanutils.BeanUtils]    
Target bean = org.apache.commons.beanutils.LazyDynaBean@1e56601
2006-02-17 12:25:53,796 DEBUG [org.apache.commons.beanutils.BeanUtils]    
Target name = test
2006-02-17 12:25:53,796 DEBUG [org.apache.commons.beanutils.ConvertUtils]
Convert string 'raaaah' to class 'java.lang.Object'
2006-02-17 12:25:53,796 DEBUG [org.apache.commons.beanutils.ConvertUtils]  
Using converter org.apache.commons.beanutils.converters.StringConverter@1847db1

and then for the other field :

2006-02-17 12:25:53,796 DEBUG [org.apache.commons.beanutils.BeanUtils]  
setProperty(nz.web.form.BaseDynaForm@5c4833, links[0].link.priority, [2])
2006-02-17 12:25:53,796 DEBUG [org.apache.commons.beanutils.BeanUtils]    
Target bean = null
2006-02-17 12:25:53,796 DEBUG [org.apache.commons.beanutils.BeanUtils]    
Target name = priority
2006-02-17 12:25:53,796 ERROR
[org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/vision].[action]]
Servlet.service() for servlet action threw exception
java.lang.IllegalArgumentException: No bean specified
	at
org.apache.commons.beanutils.PropertyUtilsBean.getPropertyDescriptor(PropertyUtilsBean.java:751)
	at org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:937)
	at org.apache.commons.beanutils.BeanUtilsBean.populate(BeanUtilsBean.java:811)
	at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:298)
	at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:493)
	at
org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:805)
	at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:203)
	at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
	at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)

and the struts html output:
<li>
  <input type="text" name="links[0].test" value="raaaah">
  <input type="text" name="links[0].link.priority" value="0">
</li>

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


DO NOT REPLY [Bug 38689] - nested properties on beans fetched from a list do not get populated

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38689>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38689


niallp@apache.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID




------- Additional Comments From niallp@apache.org  2006-02-17 01:22 -------
This is really a question for the struts user list. Please can you post your 
questions there and only open bugzilla tickets when you you're convinced its a 
bug - rather than to get help debugging your application.

Assuming your struts ActionForm is "request" based (rather than session) then  
this typically occurs with java.util.List properties because the lazy 
ActionForm has no way of knowing what kind of bean you want instantiated in the 
java.util.List - it will grow the list automatically, but unless you implement 
something yourself to instantiate your bean, its just left null.

There is more info here (see section "3. Controlling Properties via struts-
config.xml"):

http://www.niallp.pwp.blueyonder.co.uk/lazyactionform.html

closing as INVALID

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org