File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help regarding logic:iterate tag

 
Sana Jay
Greenhorn
Posts: 26
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello,
I am using logic:iterate to get multiple input parameters.The logic:iterator tag in my jsp is as shown.

<logic:iterate name="rowsForm" property="iterator" id="row" type="test.RowForm">
</logic:iterate>
In my Form.
i have get and set property for the String[] RowId and String[] RowProperty
The error is
Cannot create iterator for this collection
So wat should be the getter and setter for iterator.
Can anyone plz explain this.
Thanks in advance
Sana
 
Sana Jay
Greenhorn
Posts: 26
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello,
Thanks but i just found out the answer for my question.Iterator iterates through a 'collection' of my property.
But i am facing another problem....
In my Jsp page i am unable to get a textfield initially.Only after submitting the form the textfield is seen populated with the values which i have populated manually.
I am unable to figure out the reasons for this.
Can anyone plz guide.
Thanks,
Sana
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There could be a number of reasons.
You say the textfields should have pre-populated values - where are you setting these values in your code???
My first hunch would be to say that your form is resetting your values to null.
How 'bout some code?
 
Sana Jay
Greenhorn
Posts: 26
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello,
The jsp code is as follows.
<table>
<tr>
<th>id</th>
<th>property</th>
</tr>
<logic:iterate name="rowsForm" property="iterator" id="row" type="rowtest.RowForm">
<tr>
<td>
<bean:write name="row" property="rowId" />
<html:hidden name="row" property="rowId" />
</td>
<td>
<html:text name="row" property="rowProperty" />
</td>
</tr>
</logic:iterate>
</table>
<html:submit property="Submit">Submit</html:submit>

I am not getting the textfield(of rowproperty) displayed in the jsp page initially.Is it becos the iterator iterates only when the collection is not null.
Only the <th>id and <th>rowproperty is displayed.
But no textfield for the rowproperty.
Only when submitted the textfield is displayed with the values assigned in the form to the properties.
How to go abt this.

Thanks
Sana
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The iterator can't iterate if the collection is null, or even if the collection isn't null but holds no Objects. There's nothing to iterate through in that case.
It says "for each object found in the collection, do what's between the tags". If no objects are found, you'll never see what is between the tags.
 
Sana Jay
Greenhorn
Posts: 26
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello,
Thanks,,I have got it to work.I just had to intialize the property in the form.
regards,
Sana
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic