• 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

Work with database using Hibernate in JSP

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Bartender
Posts: 1845
10
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Why am I so drawn to cherry pie? I can't seem to stop. Save me tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic