wood burning stoves 2.0*
The moose likes JSP and the fly likes problem calling servlet to build a list of data from a database and display a jsp page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "problem calling servlet to build a list of data from a database and display a jsp page" Watch "problem calling servlet to build a list of data from a database and display a jsp page" New topic
Author

problem calling servlet to build a list of data from a database and display a jsp page

Efekodo Kingsley
Greenhorn

Joined: Mar 16, 2009
Posts: 6
please need help solving the problem of calling a servlet to build list of data from a database and display it on a jsp page.anytime i run my jsp code it gives me a runtime error.

my servlet code

my jsp code


error message

thanks for usual understanding
Balu Sadhasivam
Ranch Hand

Joined: Jan 01, 2009
Posts: 874



List data= (List)request.getAttribute("data");


One thing to suspect is the request.getAttribute("data") returns null . Is the request originated from servlet ? or you directly hit the jsp.
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3825

And, how you map the servlet in web.xml & access the servlet from the URL?


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
Efekodo Kingsley
Greenhorn

Joined: Mar 16, 2009
Posts: 6
yes,the request is originated from the servlet.am using netbean ide,i think the ide does the mapping for me.can some one help to find a solution. thanks
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3825

Efekodo Kingsley wrote:am using netbean ide,i think the ide does the mapping for me.can some one help to find a solution.


So, How do you deploy & invoke the servlet? Inside a web container? If so we need to see your web.xml mapping and URL used to invoke the servlet.
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
Is the servlet invoked at any way? Run a debugger or place sysouts at strategic locations printing the info or variables of interest.

Apart from the actual problem, you should not use scriptlets. Drop them all and use taglibs and EL. The JSTL's c:forEach tag is perfectly suitable for looping over a List.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: problem calling servlet to build a list of data from a database and display a jsp page