第二步:
建立一个struts.xml放置src目录
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"> <struts> <constant name="struts.enable.DynamicMethodInvocation" value="true"></constant> <constant name="struts.devMode" value="false"></constant> <constant name="struts.i18n.encoding" value="UTF-8"></constant> <constant name="struts.serve.static.browsercade" value="false"></constant> <constant name="struts.custom.i18n.resources" value="message"></constant> <constant name="struts.objectFactory" value="spring"></constant> <!--<constant name="struts.action.extension" value="action"></constant>--> <include file="/config/struts/struts-login.xml"></include> <include file="/config/struts/struts-logistics.xml"></include> </struts>
建立一个struts.xml放置src目录
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"> <struts> <constant name="struts.enable.DynamicMethodInvocation" value="true"></constant> <constant name="struts.devMode" value="false"></constant> <constant name="struts.i18n.encoding" value="UTF-8"></constant> <constant name="struts.serve.static.browsercade" value="false"></constant> <constant name="struts.custom.i18n.resources" value="message"></constant> <constant name="struts.objectFactory" value="spring"></constant> <!--<constant name="struts.action.extension" value="action"></constant>--> <include file="/config/struts/struts-login.xml"></include> <include file="/config/struts/struts-logistics.xml"></include> </struts>
解决方案 »
- struts 和 Jsp 的问题
- 用java如何获取对MS Server2005刚刚插入数据的ID值?
- lomboz eclipse的JSP问题
- Struts2 问题 -include标签
- 请教CITRIX是什么开发工具,AIX5.2是什么操作系统???
- 图形如何发到油箱中? 非常感谢!
- 100求cmp2.0 relation 的两个问题?
- 在EJB中如何访问Sql Server 2000?
- 谁能告诉我EJB中Resource References如何配置,71分送上!!
- 多条件查询后将查询条件返回,然后怎么写才不会报空指针错误
- 请教一个hibernate的保存一对多实例的问题。
- 简单框架第五步:
建立一个applicationContext.xml ,该文件目录:src/config/applicationContext.xml: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd"> <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="location" value="classpath:config/init.properties" /> </bean> <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="driverClassName"> <value>com.mysql.jdbc.Driver</value> </property> <property name="url"> <value>${jdbcUrl}</value> </property> <property name="username"> <value>${user}</value> </property> <property name="password"> <value>${password}</value> </property> </bean> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource" ref="dataSource" /> <property name="mappingResources"> <list> <value>config/hbm/TUser.hbm.xml</value> <value>config/hbm/TRole.hbm.xml</value> <value>config/hbm/TModule.hbm.xml</value> <value>config/hbm/TFunction.hbm.xml</value> <value>config/hbm/TSendBack.hbm.xml</value> <value>config/hbm/TStock.hbm.xml</value> <value>config/hbm/TSubstance.hbm.xml</value> </list> </property> <property name="hibernateProperties"> <props> <!-- 指定数据库方言 --> <prop key="hibernate.dialect"> org.hibernate.dialect.MySQLInnoDBDialect</prop> <prop key="cache.provider_class">org.hibernate.cache.EhCacheProvider </prop> <!-- 是否根据需要每次自动创建数据库 --> <prop key="hibernate.hbm2ddl.auto">update</prop> <!-- 显示Hibernate持久化操作所生成的SQL --> <!--<prop key="hibernate.show_sql">true</prop> --><!-- 到多少sql的时候执行,批量处理 --> <prop key="hibernate.jdbc.batch_size">20</prop> <!-- 取数据的时候每次从数据库中取出的记录条数 --> <prop key="hibernate.jdbc.fetch_size">50</prop> </props> </property> <property name="eventListeners"> <map> <entry key="merge"> <bean class="org.springframework.orm.hibernate3.support.IdTransferringMergeEventListener" /> </entry> </map> </property> </bean> <!-- Transaction manager for a single JDBC DataSource --> <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource" ref="dataSource" /> </bean> <import resource="classpath:config/spring/applicaitonContext-logistics.xml" /> <import resource="classpath:config/spring/applicaitonContext-login.xml" /> </beans>