• 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
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Retrieve data from database in JSP(simple CRUD)  RSS feed

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello! I just started learning Java EE, created simple MySQL DB and decided to retrieve DB data in JSP page using servlets. But nothing shows up, only table headers. Although printed out everything to the console using main method, just to make sure that the getAll() method in DAO layer works. Could you please tell me what am I doing wrong here:

Controller Servlet:


web.xml:



index.jsp:

Untitled.jpg
[Thumbnail for Untitled.jpg]
 
Sheriff
Posts: 67257
170
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your web.xml is wrong. It shouldn't be using the old DOCTYPE. See the JspFaq (this one: http://www.coderanch.com/how-to/java/ElOrJstlNotWorkingAsExpected) for information on properly setting up the web.xml.
 
Bear Bibeault
Sheriff
Posts: 67257
170
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should also be declaring your JSP/HTML as HTML5, not HTML4. You are apparently using some pretty old and dated source material.
 
Serge Pietel
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Bear Bibeault wrote:You should also be declaring your JSP/HTML as HTML5, not HTML4. You are apparently using some pretty old and dated source material.



Thanks for quick response, I changed my web.xml specifying HTML5 in it, but it didn't help, same output:( Currently reading Head First JSP & Servlets.
 
Bear Bibeault
Sheriff
Posts: 67257
170
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


The HTML5 declaration is for the HTML (generated by the JSP) and has nothing to do with the web.xml.

Read the FAQ I linked to; it will show you how to properly configure the web.xml.
 
Serge Pietel
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Bear Bibeault wrote:

The HTML5 declaration is for the HTML (generated by the JSP) and has nothing to do with the web.xml.

Read the FAQ I linked to; it will show you how to properly configure the web.xml.



Thanks, I read it... Probably the problem was with my Eclipse's workspace: I deleted one messy project in it, reconfigured Tomcat server and cleaned my project and it works!
 
Did you just should on me? You should read this tiny ad:
ScroogeXHTML - small and flexible RTF to HTML converter library
https://coderanch.com/t/710903/ScroogeXHTML-RTF-HTML-XHTML-converter
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!