wood burning stoves 2.0*
The moose likes Struts and the fly likes logic:iterate with Textarea Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "logic:iterate with Textarea" Watch "logic:iterate with Textarea" New topic
Author

logic:iterate with Textarea

Mittal Mistry
Greenhorn

Joined: May 17, 2006
Posts: 3
I want to geerate teatarea dynamicaly. For that i take ArrayList of solution Textarea...i have written following code for that..

<jsp:useBean id="solution" class="java.util.ArrayList" scope="page" />

</jsp:useBean>
<logic:iterate name="solution" id="addSolution">
<td><html:textarea property="solution" name="addSolution" indexed="true"/></td>
</logic:iterate>

Jsp is not giving error..it displaying other control..but this textarea is not getting displayed..its not going in iterate loop..What can be a problem

Please help me if any one know abt it

Thankx and regards
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
First of all, you have to write some code to populate this ArrayList before executing the code in the JSP. Otherwise, the list will always be empty and the <logic:iterate> tag will have nothing to iterate over.

Secondly, if you want to have inputs on your form that are used by Struts to automatically populate a bean, the properties you wish to populate must be in the ActionForm bean associated with that page's action. You can't just put an array of objects into some scope and expect Struts to populate them when the form is submitted.

You would need to define the solution List as a property on your ActionForm bean and then define a getter/setter pair for the whole list, and another getter/setter pair to retrieve or set a single element of the list given it's index.

this link will give you some good information about using indexed properties in forms.


Merrill
Consultant, Sima Solutions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: logic:iterate with Textarea
 
Similar Threads
problem laying out element of ordered list with logic iterate
How do I iterate the object which is in Session (in a JSP)?
how to use logic:iterate for ArrayLists withing Collection
Data grid
html:link in logic:iterate