Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

display selective value from VECTOR

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
use logic:equal to compare your values.
 
aamchi mumbai
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Anyone knows answer for this
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Check out the following link on using indexed properties. It explains how to do it:

http://struts.apache.org/faqs/indexedprops.html
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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:
 
reply
    Bookmark Topic Watch Topic
  • New Topic