i am trying to print an array list in a jsp page like this:
<body>
<FORM METHOD="POST" ACTION="index.jsp">
<input type="text" name="text" value="" />
<input type="submit" value="add" />
</FORM>
<jsp:useBean id="tomer" class="java.util.ArrayList" scope="session"/>
<jsp:useBean id="r1" class="java.util.Iterator" scope="session"/>
<% if (request.getParameter("text") !=null) {%>
<% tomer.add(request.getParameter("text"));%>
<%}%>
<%r1 = tomer.iterator();%>
<%while(r1.hasNext())%>
<%{%>
<%r1.next();%>
<%="\n"%>
<%}%>
</body>
when i try to run it gives me an error about an invalid attribute java.util.Iterator.
how can i fix the error.
is there a better way to print an array list in jsp ?