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
I'm not going to be a Rock Star. I'm going to be a LEGEND! --Freddie Mercury
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.
Joined: Nov 27, 2001
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: