Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

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

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 874
Android VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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.
 
Bartender
Posts: 4107
72
Hibernate Fedora Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And, how you map the servlet in web.xml & access the servlet from the URL?
 
Efekodo Kingsley
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4107
72
Hibernate Fedora Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
 
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
I child proofed my house but they still get in. Distract them with this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic