0

I have an array list with multiple value on jsp, and I want to iterate the array list. so that I can assign the values one by one in a textarea.

My jsp code:

<%
for(i=0;i<padetaillist.size();i++)
{
%>

<textarea id="txtpmhistory" class="txtpmhistoryy" name="txtpmhistory" 
         rows="1" cols="150" placeholder="Past Medical History">

  <%=padetaillist.get(i).getpmhistory()%></textarea>

<textarea id="txttobbaco" class="txttobbaco" name="txttobbaco" 
        rows="1" cols="150" placeholder="Tobbaco or Smoking">

I think this is wrong, I have several textareas but my jsp is not even displaying a single one.

So how can I iterate my arraylist so that I can assign the value to a text area and my jsp will display properly? Is there any way that I can iterate my arraylist in JavaScript or with jquery and assign the value to a textarea?

Thanks Rushang

Pieter
  • 17,075
  • 7
  • 48
  • 88
rushang patel
  • 105
  • 2
  • 9

1 Answers1

0

You should not be doing it like this.

Use STL and use the core taglib and the foreach function

see this example

<c:foreach jsp iterate over list

Community
  • 1
  • 1
Scary Wombat
  • 43,525
  • 5
  • 33
  • 63