Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need advise with this servlet please!!!!

 
Andres Gonzalez
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys. The general idea of this servlet is:
1o.) makes a connection to a database. For every record in the resultSet, the servlet creates a bean and stores it in a vector. Then, when the resultset is finished, I put the vector in the request (request,setAttribute(...)), so I can have access to it in the JSP page. Here's the code my friends:

So far so good. Now, in the JSP page I do this:

The problem is that the JSP doesn't show anything at all! . I've tested with println in the servlet and the servlet is creating the bean correctly with the information and it is added propertly to the vector, but when I try to access it from the JSP page the vector has the number of records but no data at all...
Any ideas guys? i really apreciate it...
cheers
 
Andres Gonzalez
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry guys, the JSP is this one:
 
Craig Jackson
Ranch Hand
Posts: 405
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe the soluction to your problem is that you need to declare an import statement which imports Bulletin.ProductBean instead of using the <jsp:usebean> command and then declare either a global or local reference to the bean which you will access in your while loop.
such as...
<%@ page import Bulletin.ProductBean %>
<%! ProductBean items; %> or
ProductBean items = (ProductBean)i.next();
What do you think.
 
Andres Gonzalez
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, that was the "error". thank you so much. This is really weird. I've been following an example like this one in web development with JavaServer pages book. THis means the book is wrong, coz I was using the same conventions as they were..
thanks again. This is the code:

cheers
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic