Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

display selective value from VECTOR

 
aamchi mumbai
Greenhorn
Posts: 19
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
Vicky Pandya
Ranch Hand
Posts: 148
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
use logic:equal to compare your values.
 
aamchi mumbai
Greenhorn
Posts: 19
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anyone knows answer for this
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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:
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic