This is the actual combat JSP advanced programming three.
Today spent a few hours, and finally the room inside the development of tomcat+hibernate, learning environment configured well.
Application scenarios: Tomcat 5.5, Hibernate 2.1.7, MySQL 3.23.43, MySQL driver:3.0.14, jdk:1.4.2 os:turbolinux Server 8.0
User environment: General Student Account--J2EE, location:/home/j2ee/public_html
For the convenience of beginners, this tutorial is specially simplified.
1. Add the jar copy from the Hibernate manual hibernate2.jar,dom4j,ehcache,cglib to web-inf/lib.
2. Will hibernate.cfg.xml copy into Web-inf inside.
Intranet users as long as the direct copy from the/home/j2ee/public_html/web-inf can be.
The outside reader also only needs to change the MySQL parameter in the hibernate.cfg.xml to be possible.
3. This example is a further simplification of the prevailing cat examples, with only 2 fields:
cat_id varchar, name varchar (50).
4. The following documents are available in WEB-INF/HB:
Cat.java
Cat.hbm.xml
Hibernateutil.java
5.2 JSP files for testing:
addcat.jsp
getcats.jsp