*
The moose likes JSP and the fly likes vector problem,how to retrieve data stored in vector and display in jsp pag    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 » Java » JSP
Bookmark "vector problem,how to retrieve data stored in vector and display in jsp pag    " Watch "vector problem,how to retrieve data stored in vector and display in jsp pag    " New topic
Author

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

saswat rashmi
Greenhorn

Joined: Jul 31, 2007
Posts: 14
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 ]
Muhammad Saifuddin
Ranch Hand

Joined: Dec 06, 2005
Posts: 1321

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.


Saifuddin..
[Blog][Linkedin] How To Ask Questions On JavaRanch My OpenSource
shankar reddy
Ranch Hand

Joined: Jun 04, 2007
Posts: 71
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());
}


Java Lover<br /> <br />Shankar Reddy <br />SCJP1.4 (88%)
shankar reddy
Ranch Hand

Joined: Jun 04, 2007
Posts: 71
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());
}
Michael Ku
Ranch Hand

Joined: Apr 20, 2002
Posts: 510
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).
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: vector problem,how to retrieve data stored in vector and display in jsp pag
 
Similar Threads
calling a stored procedure in Jsp
Display each results from database in their own row
alternate table row bgcolor using if/else
Menu Component
Error with jsp and JavaBeans