Struts + Hibernate configuration problem

xiaoxiao2021-03-06  43

Struts Hibernate configuration problem

First of all or configure the problem, remember to introduce the package to be used in Struts and Hibernate (unclearly, you will be introduced). In terms of configuration files, Struts and Hibernate can be configured separately. Both sides do not interfere with each other, just remember that Hibernate's profile is put on the root directory of SRC (do not put it in the package, this is to generate the root of Classes Under contents).

Examples are as follows:

Web.xml:

Action

Org.apache.struts.Action.ActionServlet

config

/web-inf/struts-config.xml

debug

3

detail

3

0

Action

*. do

http://jakarta.apache.org/struts/tags-logic

/Web-inf/tlds/struts-logic.tld

Http://jakarta.apache.org/struts/tags-html

/web-inf/tlds/struts-html.tld

http://jakarta.apache.org/struts/tags-bean

/Web-inf/tlds/struts-bean.tld

Struts-config.xml:

Attribute = "form"

Name = "form"

PATH = "/ test"

Scope = "request"

TYPE = "com.ln.struts.action.testaction">

Hibernate.cfg.xml:

"- // Hibernate / Hibernate Configuration DTD 2.0 // en"

"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">

root

JDBC: mysql: //192.168.151.72: 3306 / QuickStart

Net.sf.hibernate.Dialect.MysqldiaLect

com.mysql.jdbc.driver

TableName.hmb.xml:

"- // Hibernate / Hibernate mapping DTD 2.0 // en"

"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

转载请注明原文地址:https://www.9cbs.com/read-67087.html

New Post(0)