导读:
首先还是配置问题,记住引入Struts和Hibernate要用到的包(不清楚地话就全部都引进去)。配置文件方面,struts和Hibernate都可以单独配置.双方互不干扰,只是要记住Hibernate的配置文件要放在src的根目录下(不要放到包里,这样是为了它能生成到classes的根目录下)。
示例如下:
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" > 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"> "-//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"> "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
Trackback: http://tb.blog.youkuaiyun.com/TrackBack.aspx?PostId=259504
本文转自
http://blog.youkuaiyun.com/123xxx/archive/2005/01/19/259504.aspx
首先还是配置问题,记住引入Struts和Hibernate要用到的包(不清楚地话就全部都引进去)。配置文件方面,struts和Hibernate都可以单独配置.双方互不干扰,只是要记住Hibernate的配置文件要放在src的根目录下(不要放到包里,这样是为了它能生成到classes的根目录下)。
示例如下:
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" > 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"> "-//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"> "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
Trackback: http://tb.blog.youkuaiyun.com/TrackBack.aspx?PostId=259504
本文转自
http://blog.youkuaiyun.com/123xxx/archive/2005/01/19/259504.aspx