sharath_kulal
asked on
Struts Form containing Vector
My Struts Form Contains a vecotor. how do i display the contents of the Vector using struts iterate?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If the elements in the Vector are Strings, I don't think you need to specify a property.
Example:
<logic:iterate id="elementId" name="yourVector" type="java.lang.String">
<bean:write name="elementId"/>
</logic:iterate>
Example:
<logic:iterate id="elementId" name="yourVector" type="java.lang.String">
<bean:write name="elementId"/>
</logic:iterate>
yes your right, Property is required if the collection contains javabean
Thank you for correcting me
Thank you for correcting me
Hi sharath_kulal,
Well, I hope that my example can help you to understand how to iterate vector in JSP using iterate tags.
<html>
<%
Vector a = new Vector();
a.add("1");
a.add("2");
request.setAttribute("Vect or", a);
%>
<body class="bodycontent">
<logic:iterate id="test" name="Vector">
<bean:write name="test" />
</logic:iterate>
</body>
</html>
Thanks.
Regards
Dave
Well, I hope that my example can help you to understand how to iterate vector in JSP using iterate tags.
<html>
<%
Vector a = new Vector();
a.add("1");
a.add("2");
request.setAttribute("Vect
%>
<body class="bodycontent">
<logic:iterate id="test" name="Vector">
<bean:write name="test" />
</logic:iterate>
</body>
</html>
Thanks.
Regards
Dave
<logic:iterate id="myVal" name="vector" type="java.lang.Whatever">
//do something
</logic:iterate>
</logic:iterate>
-----------------
or try
-----------------
<logic:iterate id="myVal" collection="<%= vector %>" type="java.lang.Whatever">
//do something
</logic:iterate>
Note: neither of these were tested.