Struts Form containing Vector

My Struts Form Contains a vecotor. how do i display the contents of the Vector using struts iterate?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

<logic:iterate id="vector" name="myHash" type="java.util.Vector">
<logic:iterate id="myVal" name="vector" type="java.lang.Whatever">
//do something

or try
<logic:iterate id="myVal" collection="<%= vector %>" type="java.lang.Whatever">
//do something

Note: neither of these were tested.
Where is your Vector?
Is it in Session scope or request scope?
if you don't specify scope attribute in logic:iterate then it looks for your vector in session scope.

<logic:iterate id="mList" scope="session"  name="yourVectorName" type="data type of objects that vector holds">

For Example:
If your vector contains  the collection of descriptions of type String and it is named as myVector and added to the session scope then you logic:iterate tag would look like this

<logic:iterate id="mList" scope="session"  name="myVector" type="java.lang.String">
   <bean:write  name="mList" property="description"/>

Hope this helps

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
If the elements in the Vector are Strings, I don't think you need to specify a property.

<logic:iterate id="elementId" name="yourVector" type="java.lang.String">
   <bean:write name="elementId"/>

yes your right, Property is required if the collection contains javabean

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.


    Vector a = new Vector();
    request.setAttribute("Vector", a);
<body class="bodycontent">
<logic:iterate id="test" name="Vector">
    <bean:write name="test" />


It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.