• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

vector problem,how to retrieve data stored in vector and display in jsp pag

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi everyone

i ma getting problem in vector. i hve on ejsp page ,in which i am using vector ,to store the data from databse ,but i dont knwo how to retrive the values store in vector ,so that i can display all records in jsp page

please help


please tell me where i am wrong .i want to dipaly the value from databse which i have stored in vector,but i dont knwo how to get values form vector one by one qand dispaly
[ October 24, 2007: Message edited by: Ben Souther ]
 
Ranch Hand
Posts: 1325
Android Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,

it more like bad practice if you do data manupulation in your jsp, as jsp only use for view, I like to refer to you "Simple MVC" by ben souther, http://faq.javaranch.com/java/CodeBarnServlets

hope it helps.
 
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
You are storing the values in the vector, by using while loop. Now the data is readily available in the Vector. You can use Enumarator to get the elements.

for (Enumeration e = v.elements() ; e.hasMoreElements() ;) {
System.out.println(e.nextElement());
}
 
shankar reddy
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
You are storing the values in the vector, by using while loop. Now the data is readily available in the Vector. You can use Enumarator to get the elements.

for (Enumeration e = v.elements() ; e.hasMoreElements() ;) {
System.out.println(e.nextElement());
}
 
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You should move away from scripting on the JSP so getting a Enumeration from the vector and looping in the JSP is still a bad idea. Look into JSTL tag c:forEach to do this.

Also

Vector VOUCHER_ID;


Why are you using capital letters for your variable names? This convention is for static final variables (constants).
 
reply
    Bookmark Topic Watch Topic
  • New Topic