wood burning stoves*
The moose likes Servlets and the fly likes Need advise with this servlet please!!!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Need advise with this servlet please!!!!" Watch "Need advise with this servlet please!!!!" New topic
Author

Need advise with this servlet please!!!!

Andres Gonzalez
Ranch Hand

Joined: Nov 27, 2001
Posts: 1561
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
Andres Gonzalez
Ranch Hand

Joined: Nov 27, 2001
Posts: 1561
Sorry guys, the JSP is this one:
Craig Jackson
Ranch Hand

Joined: Mar 19, 2002
Posts: 405
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

Joined: Nov 27, 2001
Posts: 1561
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Need advise with this servlet please!!!!
 
Similar Threads
Sending database data from Servlet to JSP
strange error... " before start of result set.." ???
Retreiving an image using JDBC
From jsp to servlet to jsp?
can anyone help me using jspsmartupload to upload an image???