• Post Reply Bookmark Topic Watch Topic
  • New Topic

Work with database using Hibernate in JSP

 
German Lamberet
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,
I've created my first web application with Hibernate support.

Here is my JSP file:



But, I got the following error from my Tomcat



Here is the screenshot of my project organization:



What can be a source of that error?

P.s. Please don't tell me that "it's bad idea to use scriplets in JSP" :) I understand it. Trying to understand from the very beging how it works, next step is improving the code.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65524
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
German Lamberet wrote:Please don't tell me that "it's bad idea to use scriplets in JSP" :) I understand it. Trying to understand from the very beging how it works, next step is improving the code.

Sorry, but it's a bad idea even when beginning.

Looks as if the Hibernate classes (there are many it depends on) aren't in WEB-INF/lib.
 
Stefan Evans
Bartender
Posts: 1822
10
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Honestly, this code could just be copied and pasted straight into a java class, and it will work exactly the same way.
You are doing NOTHING here that requires a JSP.

Putting this code into a java class in Eclipse will actually help you diagnose the problem. Compilation will fail because the required classes aren't in the classpath.
You can fix up the problems at compile time, rather than runtime which is a LOT easier with the IDE to help you.


 
German Lamberet
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks guys,
I've put HIbernate classes to WEB-INF/lib manually and that helped.
But, I am using maven and expected that maven will download and place them into appropriate folder. I see, that it's not.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!