`
xxp3369
  • 浏览: 152383 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

ssh_training_itemmgr 01

阅读更多
applicationContext-actions.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"
     xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
           http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
           http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
   
    <bean name="/user/login" class="com.bjsxt.drp.web.itemmgr.actions.LoginAction"/>
   
    <bean name="/basedata/item" class="com.bjsxt.drp.web.itemmgr.actions.ItemAction">
    <property name="itemManager" ref="itemManager"/>
    <property name="uploadPath">
    <value>C:\\apache-tomcat-5.5.26\\webapps\\ssh_training_itemmgr\\images\\item\\</value>
    </property>
    </bean>
   
    <bean name="/basedata/changelan" class="com.bjsxt.drp.web.itemmgr.actions.ChangeLanguageAction"/>
</beans>



applicationContext-beans.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"
     xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
           http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
           http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">

<bean id="itemManager" class="com.bjsxt.drp.business.itemmgr.manager.ItemManagerImpl">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>

<bean id="myfunction" class="com.bjsxt.drp.business.util.Functions">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
</beans>


applicationContext-common.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"
     xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
           http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
           http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
<!-- 配置sessionFactory -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation">
<value>classpath:hibernate.cfg.xml</value>
</property>
</bean>          

<!-- 配置事务管理器 -->
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref bean="sessionFactory"/>
</property>
</bean>

<!-- 配置事务的传播特性 -->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="add*" propagation="REQUIRED"/>
<tx:method name="del*" propagation="REQUIRED"/>
<tx:method name="modify*" propagation="REQUIRED"/>
<tx:method name="*" read-only="true"/>
</tx:attributes>
</tx:advice>

<!-- 那些类的哪些方法参与事务 -->
<aop:config>
<aop:pointcut id="allManagerMethod" expression="execution(* com.bjsxt.drp.business.itemmgr.manager.*.*(..))"/>
<aop:advisor pointcut-ref="allManagerMethod" advice-ref="txAdvice"/>
</aop:config>
</beans>


hibernate.cfg.xml


引用
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.url">jdbc:mysql://localhost/hibernate_struts_training_itemmgr</property>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">bjsxt</property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.show_sql">true</property>

<property name="hibernate.hbm2ddl.auto">update</property>

<mapping resource="com/bjsxt/drp/business/itemmgr/model/DataDict.hbm.xml"/>
<mapping resource="com/bjsxt/drp/business/itemmgr/model/Item.hbm.xml"/>
</session-factory>
</hibernate-configuration>


Web.xml

引用
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

  <!-- Standard Action Servlet Configuration (with debugging) -->
  <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>


  <!-- Standard Action Servlet Mapping -->
  <servlet-mapping>
    <servlet-name>action</servlet-name>
    <url-pattern>*.do</url-pattern>
  </servlet-mapping>

  <context-param>
  <param-name>contextConfigLocation</param-name>
  <param-value>classpath*:applicationContext-*.xml</param-value>
  </context-param>
  
   <listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
   </listener>
  
  <filter>
    <filter-name>Spring character encoding filter</filter-name>
    <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
    <init-param>
    <param-name>encoding</param-name>
    <param-value>GBK</param-value>
    </init-param>
  </filter>

  <filter-mapping>
    <filter-name>Spring character encoding filter</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>
 
  <filter>
    <filter-name>hibernateFilter</filter-name>
    <filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
  </filter>
<filter-mapping>
    <filter-name>hibernateFilter</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>
</web-app>


struts-config.xml

引用
<?xml version="1.0" encoding="ISO-8859-1" ?>

<!DOCTYPE struts-config PUBLIC
          "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"
          "http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd">
<struts-config>
<form-beans>
<form-bean name="loginForm" type="com.bjsxt.drp.web.itemmgr.forms.LoginActionForm"/>
<form-bean name="itemForm" type="com.bjsxt.drp.web.itemmgr.forms.ItemActionForm"></form-bean>
</form-beans>

<global-exceptions>
   <exception key="error.exception"
                  type="com.bjsxt.drp.business.util.AppException"
                  handler="com.bjsxt.drp.web.util.DrpExceptionHandler"
                  path="/WEB-INF/jsp/error.jsp"/>   

</global-exceptions>

<global-forwards>
<forward name="index" path="/index.jsp" redirect="true"/>
</global-forwards>

<action-mappings>

<action path="/user/login"
type="org.springframework.web.struts.DelegatingActionProxy"
name="loginForm"
scope="request"
>
<forward name="sucess" path="/basedata/item.do?command=list&amp;pageNo=1&amp;pageSize=2" redirect="true"/>
</action>

<action path="/basedata/additem"
forward="/WEB-INF/jsp/basedata/item_add.jsp"
name="itemForm"
>
</action>

<action path="/basedata/item"
type="org.springframework.web.struts.DelegatingActionProxy"
name="itemForm"
scope="request"
parameter="command"
>
<forward name="modify_detail" path="/WEB-INF/jsp/basedata/item_modify.jsp"/>
<forward name="find_detail" path="/WEB-INF/jsp/basedata/item_detail.jsp"/>
<forward name="list_success" path="/WEB-INF/jsp/basedata/item_maint.jsp"/>
<forward name="upload_detail" path="/WEB-INF/jsp/basedata/item_upload.jsp"/>
</action>

<action path="/basedata/changelan"
type="org.springframework.web.struts.DelegatingActionProxy"
scope="request"
>
<forward name="success" path="/index.jsp" redirect="true"/>
</action>

</action-mappings>

    <message-resources parameter="MessageResources" />
</struts-config>


drp-functions.tld

引用
<?xml version="1.0" encoding="UTF-8" ?>

<taglib xmlns="http://java.sun.com/xml/ns/j2ee"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
  version="2.0">
  <display-name>drp functions</display-name>
  <tlib-version>1.0</tlib-version>
  <short-name>drp</short-name>
  <uri>http://www.bjsxt.com/drp/functions</uri>
 
  <function>
    <name>getItemCategoryList</name>
    <function-class>com.bjsxt.drp.business.util.Functions</function-class>
    <function-signature>java.util.List getItemCategoryList()</function-signature>
  </function>
 
  <function>
    <name>getItemUnitList</name>
    <function-class>com.bjsxt.drp.business.util.Functions</function-class>
    <function-signature>java.util.List getItemUnitList()</function-signature>
  </function>
 
</taglib>


log4j.properties


引用
### direct log messages to stdout ###
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n

### direct messages to file hibernate.log ###
#log4j.appender.file=org.apache.log4j.FileAppender
#log4j.appender.file.File=hibernate.log
#log4j.appender.file.layout=org.apache.log4j.PatternLayout
#log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n

### set log levels - for more verbose logging change 'info' to 'debug' ###

log4j.rootLogger=warn, stdout

#log4j.logger.org.hibernate=info
#log4j.logger.org.hibernate=debug

### log HQL query parser activity
#log4j.logger.org.hibernate.hql.ast.AST=debug

### log just the SQL
#log4j.logger.org.hibernate.SQL=debug

### log JDBC bind parameters ###
#log4j.logger.org.hibernate.type=info
#log4j.logger.org.hibernate.type=debug

### log schema export/update ###
#log4j.logger.org.hibernate.tool.hbm2ddl=debug

### log HQL parse trees
#log4j.logger.org.hibernate.hql=debug

### log cache activity ###
#log4j.logger.org.hibernate.cache=debug

### log transaction activity
#log4j.logger.org.hibernate.transaction=debug

### log JDBC resource acquisition
#log4j.logger.org.hibernate.jdbc=debug

### enable the following line if you want to track down connection ###
### leakages when using DriverManagerConnectionProvider ###
#log4j.logger.org.hibernate.connection.DriverManagerConnectionProvider=trace






分享到:
评论

相关推荐

    ssh_training_itemmgr.zip

    这个"ssh_training_itemmgr.zip"压缩包很可能是提供了一个SSH框架整合的实际项目示例,帮助开发者理解和学习如何在实际应用中运用这些技术。 **Struts** 是一个基于MVC设计模式的Java Web框架,主要用于控制应用...

    SSH_Trainning

    在SSH_Training项目中,"ssh_training_itemmgr"可能是一个练习模块,专注于SSH的特定方面,比如文件管理。这可能包括如何使用`scp`和`sftp`命令进行安全文件传输,这两个命令分别用于在命令行中复制文件和通过FTP...

    spring示例代码好又全.rar

    内容如下: spring.rar [spring_aop1] ...injection1] [spring_injection2] [spring_scope] [spring_struts_1] [spring_struts_2] [spring_struts_hibernate] [spring_whyspring] [ssh_training_itemmgr]

    spring+struts+hibernate

    SSH整合是Java Web开发中的经典组合,由Spring、Struts和Hibernate三个框架构成,用于构建高效、可...这个"ssh_training_itemmgr"项目就是一个很好的实例,可以帮助初学者理解和实践SSH框架的整合,提升Web开发技能。

    物料管理系统

    通过ssh_training_itemmgr这个项目,学习者可以实践SSH框架的整合,理解MVC设计模式,掌握数据库操作,以及如何构建一个完整的业务流程。此外,该项目还可以锻炼开发者的问题调试和代码优化能力,为日后更复杂的项目...

    开源的物料资源管理系统

    在实际开发过程中,为了便于学习和研究,压缩包文件“hibernate_struts_training_itemmgr”很可能包含了项目的源代码、配置文件、数据库脚本、测试用例等相关资料。开发者可以通过阅读和分析这些文件,了解SSH框架...

Global site tag (gtag.js) - Google Analytics