This week's book giveaway is in the Reactive Progamming forum.
We're giving away four copies of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams and have Adam Davis on-line!
See this thread for details.
Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming 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
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

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: 4101
64
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: 4101
64
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'm full of tinier men! And a 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
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!