aspose file tools*
The moose likes Servlets and the fly likes best way to access the vector in jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "best way to access the vector in jsp" Watch "best way to access the vector in jsp" New topic
Author

best way to access the vector in jsp

Gina Ferrara
Greenhorn

Joined: Jul 02, 2003
Posts: 6
Hello all,
I like to know the best way to access a already populated vector in jsp.
I have servlet that talks to the backend beans and populate a vector



now in the jsp I have the following code

So is this a best practice to access the object I have placed into the vector?
Is there a better way to do this?

Gena
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30537
    
150

Yes. You can use JSTL/EL. JSTL has a c:forEach tag for looping through a vector. EL lets you ${xmlObject.name} output properties of the loop element.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61224
    
  66

Just to make sure that there is no ambiguity, Jeanne's "yes" answer was to the question:
Is there a better way to do this?


Java code in scriptlets is an extremely poor practice that it almost 10 years out-of-date.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: best way to access the vector in jsp