总论:在这一节我们要配置一个完整的应用配置。
一,resin虚拟站点配置
<host id='yourweb:8080' app-dir='e:\blog\' class-update-interval='2'>二,Dreamweaver站点的配置就不多说了。
三,Struts的配置
这里我们使用的是struts1.1,下载并解压缩到临时文件夹,就假设是tem文件夹吧
首先拷贝tem/lib/下面所有的.tld文件到站点的/WEB-INF/目录下,再拷贝所有的.jar文件到/WEB-INF/lib/目录下
最后web.xml文件中的配置差不多如下:
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app>
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>2</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>2</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<!-- The Usual Welcome File List -->
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<!-- Struts Tag Library Descriptors -->
<taglib>
<taglib-uri>/tags/struts-bean</taglib-uri>
<taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/tags/struts-html</taglib-uri>
<taglib-location>/WEB-INF/struts-html.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/tags/struts-logic</taglib-uri>
<taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/tags/struts-nested</taglib-uri>
<taglib-location>/WEB-INF/struts-nested.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/tags/struts-tiles</taglib-uri>
<taglib-location>/WEB-INF/struts-tiles.tld</taglib-location>
</taglib>
</web-app>
四,Hibernate配置
下载并拷贝/lib目录下的
hibernate2.jar
commons-beanutils.jar
commons-collections.jar
commons-dbcp.jar
commons-lang.jar
commons-logging.jar
commons-pool.jar
dom4j.jar
cglib-asm.jar
connector.jar
到应用站点的/lib目录下。接下来配置 hibernate.cfg.xml文件
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.url">
jdbc:mysql://localhost:3306/yourdatabase
</property>
<property name="hibernate.connection.driver_class">
org.gjt.mm.mysql.Driver
</property>
<property name="hibernate.connection.username">
yourname
</property>
<property name="hibernate.connection.password">
youyrpassword
</property>
<!?- 是否将运行期生成的SQL输出到日志以供调试-->
<property name="show_sql">false</property>
<!--dialect ,每个数据库都有其对应的Dialet以匹配其平台特性-->
<propertyname="dialect">net.sf.hibernate.dialect.MySQLDialect</property>
<!?- 事务管理类型,这里我们使用JDBC Transaction -->
<property name="transaction.factory_class">
net.sf.hibernate.transaction.JDBCTransactionFactory</property>
<property name="jdbc.batch_size">10</property>
<property name="jdbc.use_scrollable_resultset">true</property>
<!?映射文件配置,注意配置文件名必须包含其相对于根的全路径-->
<mapping resource="net/seerlog/hbm/Cat.hbm.xml"/>
</session-factory>
</hibernate-configuration>
本章就写到这里了先.....
本文地址:http://com.8s8s.com/it/it11678.htm