• Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
Serge Pietel
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]
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
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
Author and ninkuma
Marshal
Posts: 65833
134
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
Author and ninkuma
Marshal
Posts: 65833
134
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!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!