• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 4116
72
Mac TypeScript Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 4116
72
Mac TypeScript Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic