File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes display selective value from VECTOR Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "display selective value from VECTOR" Watch "display selective value from VECTOR" New topic
Author

display selective value from VECTOR

aamchi mumbai
Greenhorn

Joined: Mar 04, 2005
Posts: 19
Hi,

Suppose i have vector
v = new Vector();

v.add("one");
v.add("two");
v.add("three");
v.add("four");

Now i want to display only value "one" and "three". how can i write struts tag do display that value?

is there any documentation where i can get all this information?

Again
Thanks in advance
Vicky Pandya
Ranch Hand

Joined: Dec 16, 2004
Posts: 148
use logic:equal to compare your values.
aamchi mumbai
Greenhorn

Joined: Mar 04, 2005
Posts: 19
Originally posted by Vicky Pandya:
use logic:equal to compare your values.


what if i dont know the value i just know the index number
aamchi mumbai
Greenhorn

Joined: Mar 04, 2005
Posts: 19
Anyone knows answer for this
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Check out the following link on using indexed properties. It explains how to do it:

http://struts.apache.org/faqs/indexedprops.html


Merrill
Consultant, Sima Solutions
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Most struts tags are designed to work with a javaBean. A Vector is not a javaBean. Therefore, in order to do what you want using struts tags, you will need to embed the Vector in a javaBean. Usually, in Struts applications, you embed the data you're working with in a bean that is a subclass of ActionForm.

If this doesn't fit your model, then don't use Struts tags. Use jstl, or just plain old scriptlets.

Keeping in mind the above explanation, here is some code that will work:

Action form:

Action Class:

jsp:
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: display selective value from VECTOR
 
Similar Threads
Vector with bean:write tag
how to pass Vector's object thru a stream
getting error when converting vector to string
Iterating through Vector
Array problem