Struts+Hibernate的配置问题

导读:

  首先还是配置问题,记住引入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.csdn.net/TrackBack.aspx?PostId=259504



本文转自

http://blog.csdn.net/123xxx/archive/2005/01/19/259504.aspx
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值