Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

about logic:iterate and bean:write tag

 
surendar prabu
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using logic iterate tag to loop around a collection and using bean write tag to present the data.

the logic:iterate iterates a collection 'mycollection', which contains objects of mybean class.

In 'mybean' class i have three string objects which are presented through bean:write

logic:iterate name = myform property = mycollection id=mycollection
bean:write name=mycollection property=string1
bean:write name=mycollection property=string2
bean:write name=mycollection property=string3
/logic:iterate

this part of my JSP works very fine.
after using the bean:write tag, which reads the data from 'mybean' class
and after end of logic:iterate tag, when i try to point to a property of myform again, i get an exception- no getter method for property...

like
after the logic iterate tag when i write
html:hidden name=myform property=mystring
i get the exception.

my string property is present in my ActionForm and not specified in MyBean class. In this case i get the Exception. If i use the same tag before using bean:Write tag then it is working fine.

i dont know whether this is because of bean:write or logic:iterate tag, where i point to a collection which contains object of some other class.

why is this exception coming?help me.

regards
Surendar.
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the tag is correctly coded it will work either before or after the <logic:iterate>, so there has to be something wrong with the tag or the corresponding ActionForm bean.

If you want help debugging it, please show us:
  • The full text of the exception
  • Relevant portions of your struts-config.xml file
  • Relevant portions of your JSP file, including the <html:form> tag
  • Relevant portions of your ActionForm class

  • ;
    [ October 27, 2006: Message edited by: Merrill Higginson ]
     
    surendar prabu
    Ranch Hand
    Posts: 102
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Merill,
    Yes, its working fine. I made some mistake in naming the beanclass which is referred by the Id attribute. given the same name to Id attribute and name attribute in logic:iterate tag. I have changed id attribute and its working fine.
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic