Only way to get data into a Vector is by a scriptlet or in your action.
Struts 2's OGNL has a nice way of doing this but unfortunately with S1 we're left with dirty scriptlets in JSPs some of the time.

JSTL has a <c:forTokens /> that sometimes comes in handy where you provide a comma separated list of Strings and iterate through the elements.

Balazs Michnay wrote:
Thanks for the reply.
Yes, I know how to use the <logic:iterate> to display the elements of a Vector 
(or ArrayList), I just don't see how to put these values into the Vector. I mean if I 
have a Vector (or an ArrayList) property in my form bean, how do I put some of my 
form data into my bean property. Do I need to modify the setters/getters? There must 
be a way to do this...
And yes, you're right, one the data are in the Vector, I can use 
<logic:iterate> to display them.
Thanks for your help,

Regards,

MB

----- Original Message ----
From: Martin Gainty <[EMAIL PROTECTED]>
To: Struts Users Mailing List <user@struts.apache.org>
Sent: Friday, April 13, 2007 3:45:17 PM
Subject: Re: Form data to Vector

Balazs

Take a look at
http://struts.apache.org/1.0.2/api/org/apache/struts/taglib/logic/package-summary.html
you will see this example of implementing a vector via use of struts logic:iterate in your jsp

<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%
  java.util.Vector vector = new java.util.Vector();
  vector.add(new Integer(12));
  vector.add(new Integer(5));
 %>
<logic:iterate id="myCollectionElement" collection="<%= vector %>">
 Do something with myCollectionElement
</logic:iterate>
This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed.  If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy.  Thank you.

----- Original Message ----- From: "Balazs Michnay" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <user@struts.apache.org>
Sent: Friday, April 13, 2007 4:09 AM
Subject: Form data to Vector


Hi,

I have a form with two submit buttons. One should add the content of a text field to a Vector (which is in the form bean?), and the other one should point to another page that has access to the Vector values.
I'd like to know how to add form data to a Vector.
Any help would be appreciated.

Thanks a lot,

MB



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]







__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to