ssh的配置是怎么样的?

zhangsong0413 2010-05-14 10:59:35
新手求ssh的配置文件详解,高手帮帮忙啊!!!谢谢啊!!!
...全文
101 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
全是手写的吗
  • 打赏
  • 举报
回复
<?xml version="1.0" encoding="UTF-8"?>
<!-- com.tufi924.tfums.spring.config.applicationContext.xml -->
<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/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">

<!-- 配置数据源 -->
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName">
<value>org.gjt.mm.mysql.Driver</value>
</property>
<property name="url">
<value>jdbc:mysql://localhost:3306/tfums?useUnicode=true&characterEncoding=utf8&autoReconnect=true&autoReconnectForPools=true</value>
</property>
<property name="username">
<value>root</value>
</property>
<property name="password">
<value>123456</value>
</property>
</bean>

<!-- 配置SessionFactory -->
<bean id="mySessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="current_session_context_class">thread</prop>
<!-- 使用Hibernate默认的连接池 -->
<!--
<prop key="hibernate.hbm2ddl.auto">update</prop>
<prop key="jdbc.fetch_size">50</prop>
<prop key="jdbc.batch_size">30</prop>
-->
<prop key="connection.pool_size">10</prop>
<!-- 使用c3p0连接池 -->
<prop key="hibernate.connection.provider_class">
org.hibernate.connection.C3P0ConnectionProvider
</prop>
<prop key="hibernate.c3p0.min_size">8</prop>
<prop key="hibernate.c3p0.max_size">20</prop>
<prop key="hibernate.c3p0.timeout">2500</prop>
<prop key="hibernate.c3p0.maz_statements">50</prop>
</props>
</property>

<property name="mappingResources">
<list>
<value>com/tufei924/tfums/model/pojo/User.hbm.xml</value>
</list>
</property>

<property name="dataSource">
<ref bean="dataSource"/>
</property>
</bean>

<!-- 配置TransactionManager -->
<bean id="myTxManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="mySessionFactory" />
</bean>

<!-- 配置事务策略 -->
<tx:advice id="txAdvice" transaction-manager="myTxManager">
<tx:attributes>
<tx:method name="find*" propagation="REQUIRED" read-only="true"/>
<tx:method name="save*" propagation="REQUIRED"/>
<tx:method name="delete*" propagation="REQUIRED"/>
<tx:method name="update*" propagation="REQUIRED"/>
<tx:method name="*" propagation="SUPPORTS" read-only="true" />
</tx:attributes>
</tx:advice>
<aop:config>
<aop:pointcut id="productServiceMethods" expression="execution(* com.tufei924.tfums.service.*.*(..))" />
<aop:advisor advice-ref="txAdvice" pointcut-ref="productServiceMethods" />
</aop:config>

<bean id="userDAO" class="com.tufei924.tfums.dao.hibernate.UserDAO">
<property name="sessionFactory"><ref local="mySessionFactory"/></property>
</bean>
<bean id="userService"
class="com.tufei924.tfums.service.spring.UserService">
<property name="userDAO"><ref local="userDAO"/></property>
</bean>
</beans>
pangyunlong 2010-05-14
  • 打赏
  • 举报
回复
struts.xml

<?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>
<include file="struts-login.xml" />
<constant name="struts.objectFactory" value="spring" /><!-- 告诉struts类由spring注入 -->
<constant name="struts.custom.i18n.resources" value="message"></constant>


<package name="order" namespace="/order" extends="struts-default" ><!--
<interceptors>
自定义拦截器some
<interceptor name="some" class="com.flight.utils.AuthorityInterceptor"></interceptor>
<interceptor-stack name="mydefault">
配置默认拦截器
<interceptor-ref name="defaultStack"></interceptor-ref>
配置自定义拦截器
<interceptor-ref name="some"></interceptor-ref>
</interceptor-stack>
</interceptors>
<default-interceptor-ref name="mydefault"></default-interceptor-ref>
配置全局result
<global-results >
<result name="login" >/WEB-INF/jsp/login.jsp</result>
</global-results>


--><!-- 订单查询 -->
<action name="findOrderIndex" class="showOrder" method="execute">
<result >/WEB-INF/jsp/findcairlineorder.jsp</result>
</action>
<action name="findOrder" class="showOrder" method="execute">

<result type="chain">findOrderIndex</result>
</action>
<!-- 订单处理 -->
<action name="orderTreatMent" class="orderTreatMent" method="execute">

<result >/WEB-INF/jsp/dealcairlineorder.jsp</result>
</action>
<!-- 订单修改 -->
<action name="updateOrder" class="updateOrder" method="execute">

<result >/WEB-INF/jsp/editcairlineorder.jsp</result>
</action>
<action name="updateOrderAction" class="updateOrder" method="update">

<result type="redirect">findOrder</result>
</action>
<action name="updateFlightsegmentAction" class="updateFlightSegment" method="execute">

<result type="redirect">updateOrder</result>
</action>
<action name="cancel" class="cancel" method="execute">

<result type="redirect">findOrderIndex</result>
</action>
<!-- 用户查询 -->
<action name="findUserIndex" class="userAction" method="execute">
<result >/WEB-INF/jsp/user/userlist.jsp</result>
</action>
<action name="findUser" class="userAction" method="execute">
<result type="chain">findUserIndex</result>
</action>
<!-- 添加用户 -->
<action name="addUserIndex" class="addUserAction" method="showAddUserIndex">
<result >/WEB-INF/jsp/user/addUser.jsp</result>
</action>
<action name="addUser" class="addUserAction" method="execute">
<result type="redirect">findUserIndex</result>
</action>
<!-- 删除用户 -->
<action name="deleteUserAction" class="deleteUserAction" method="execute">
<result type="redirect">findUser</result>
</action>
<!-- 用户信息修改 -->
<action name="updateUserIndex" class="updateUserAction" method="showUpdateUserIndex">
<result >/WEB-INF/jsp/user/updateUser.jsp</result>
</action>
<action name="updateUser" class="updateUserAction" method="execute">
<result type="redirect">findUser</result>
</action>

</package>



<!-- 系统管理模块 -->
<package name="systemManagement" namespace="/systemManagement" extends="json-default" >
<action name="empList" class="empAction" method="execute">
<result >/WEB-INF/jsp/systemManagement/empList.jsp</result>
</action>
<action name="addEmpIndex" class="addEmpAction" method="showIndex">
<result >/WEB-INF/jsp/systemManagement/addemp.jsp</result>
</action>
<action name="addEmp" class="addEmpAction" method="execute">
<result type="redirect" >empList</result>
</action>
<action name="findDeptAction" class="findDeptAction" method="execute">
<result type="json" />
</action>
<action name="deleteEmp" class="deleteEmpAction" method="execute">
<result type="redirect" >empList</result>
</action>
<action name="updateEmpIndex" class="updateEmpAction" method="showIndex">
<result >/WEB-INF/jsp/systemManagement/updateEmp.jsp</result>
</action>
<action name="updateEmp" class="updateEmpAction" method="execute">
<result type="redirect">empList</result>
</action>


<action name="companyListIndex" class="companyAction" method="execute">
<result >/WEB-INF/jsp/systemManagement/companyList.jsp</result>
</action>

<action name="companyList" class="companyAction" method="execute">
<result type="chain">companyListIndex</result>
</action>

<action name="addCompanyIndex" class="addCompanyAction" method="showIndex">
<result >/WEB-INF/jsp/systemManagement/addcompany.jsp</result>
</action>
<action name="addCompany" class="addCompanyAction" method="execute">
<result type="redirect">companyList</result>
</action>
<action name="deleteCompany" class="deleteCompanyAction" method="execute">
<result type="redirect">companyList</result>
</action>
<action name="updateCompanyIndex" class="updateCompanyAction" method="showIndex">
<result >/WEB-INF/jsp/systemManagement/updatecompany.jsp</result>
</action>
<action name="updateCompany" class="updateCompanyAction" method="execute">
<result type="redirect" >companyList</result>
</action>

<action name="deptListIndex" class="deptAction" method="execute">
<result >/WEB-INF/jsp/systemManagement/deptList.jsp</result>
</action>
<action name="deptList" class="deptAction" method="execute">
<result type="chain">deptListIndex</result>
</action>
<action name="addDeptIndex" class="addDeptAction" method="showIndex">
<result >/WEB-INF/jsp/systemManagement/adddept.jsp</result>
</action>
<action name="addDept" class="addDeptAction" method="execute">
<result type="redirect">deptList</result>
</action>
<action name="updateDeptIndex" class="updateDeptAction" method="showIndex">
<result >/WEB-INF/jsp/systemManagement/updatedept.jsp</result>
</action>
<action name="updateDept" class="updateDeptAction" method="execute">
<result type="redirect">deptList</result>
</action>
<action name="deleteDept" class="deleteDeptAction" method="execute">
<result type="redirect">deptList</result>
</action>

<action name="sgList" class="SgAction" method="execute">
<result >/WEB-INF/jsp/systemManagement/securitygroupList.jsp</result>
</action>
<action name="addSgIndex" class="addSgAction" method="showIndex">
<result >/WEB-INF/jsp/systemManagement/addsecuritygroup.jsp</result>
</action>
<action name="addSg" class="addSgAction" method="execute">
<result type="redirect" >sgList</result>
</action>
<action name="deleteSg" class="deleteSgAction" method="execute">
<result type="redirect" >sgList</result>
</action>
<action name="updateSgIndex" class="updateSgAction" method="showIndex">
<result >/WEB-INF/jsp/systemManagement/updatesecuritygroup.jsp</result>
</action>
<action name="updateSg" class="updateSgAction" method="execute">
<result type="redirect" >sgList</result>
</action>
</package>


</struts>
pangyunlong 2010-05-14
  • 打赏
  • 举报
回复
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:tx="http://www.springframework.org/schema/tx"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">


<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation"
value="classpath:hibernate.cfg.xml">
</property>
</bean>

<bean id="hibernateTemplate"
class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory"
ref="sessionFactory" />
</bean>


<bean id="txMgr"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory"
ref="sessionFactory"/>
</bean>

<tx:advice id="txAdvice" transaction-manager="txMgr" >
<tx:attributes>
<tx:method name="*" propagation="REQUIRED" />
<tx:method name="save*" propagation="REQUIRED" />
<tx:method name="delete*" propagation="REQUIRED" />
<tx:method name="update*" propagation="REQUIRED" />
<tx:method name="find*" propagation="SUPPORTS" read-only="true"/>
</tx:attributes>
</tx:advice>

<aop:config>
<aop:pointcut id="allDao"
expression="execution(* com.flight.dao.*.*(..))"/>
<aop:advisor advice-ref="txAdvice"
pointcut-ref="allDao"/>
</aop:config>

<!-- ******************** service bean **************************** -->

<!-- orderService -->

<bean id="orderDao" class="com.flight.dao.OrderDaoImpl">
<property name="hibernateTemplate"
ref="hibernateTemplate" />

</bean>
<bean id="orderService" class="com.flight.service.order.OrderServiceImpl">
<property name="orderDao"
ref="orderDao" />
</bean>

<!-- flightsegmentService -->

<bean id="flightSegmentDao" class="com.flight.dao.FlightsegmentDaoImpl">
<property name="hibernateTemplate"
ref="hibernateTemplate" />

</bean>
<bean id="flightSegmentService" class="com.flight.service.flightsegment.FlightSegmentServiceImpl">
<property name="flightsegmentDao"
ref="flightSegmentDao" />

</bean>
<!-- userService -->
<bean id="userDao" class="com.flight.dao.UserDaoImpl">
<property name="hibernateTemplate"
ref="hibernateTemplate" />
</bean>
<bean id="userService" class="com.flight.service.user.UserServiceImpl">
<property name="userDao"
ref="userDao" />
</bean>
<!-- partyService -->
<bean id="partyDao" class="com.flight.dao.PartyDaoImpl">
<property name="hibernateTemplate"
ref="hibernateTemplate" />
</bean>
<bean id="partyService" class="com.flight.service.party.PartyServiceImpl">
<property name="partyDao"
ref="partyDao" />
</bean>


<bean id="ticketReservation" class="com.flight.service.ticketservice.TicketReservationImpl">
<property name="orderDao"
ref="orderDao" />
</bean>

<!-- departmentService -->
<bean id="departmentDao" class="com.flight.dao.DepartmentDaoImpl">
<property name="hibernateTemplate"
ref="hibernateTemplate" />
</bean>
<bean id="departmentService" class="com.flight.service.department.DepartmentserviceImpl">
<property name="departmentDao"
ref="departmentDao" />
</bean>

<!-- empservice -->
<bean id="empDao" class="com.flight.dao.EmpDaoImpl">
<property name="hibernateTemplate"
ref="hibernateTemplate" />
</bean>
<bean id="empservice" class="com.flight.service.emp.EmpserviceImpl">
<property name="empDao"
ref="empDao" />
</bean>

<!-- companyService -->
<bean id="companyDao" class="com.flight.dao.CompanyDaoImpl">
<property name="hibernateTemplate"
ref="hibernateTemplate" />
</bean>
<bean id="companyService" class="com.flight.service.company.CompanyServiceImpl">
<property name="companyDao"
ref="companyDao" />
</bean>

<!-- securitygroupService -->
<bean id="securitygroupDao" class="com.flight.dao.SecuritygroupDaoImpl">
<property name="hibernateTemplate"
ref="hibernateTemplate" />
</bean>
<bean id="securitygroupService" class="com.flight.service.securitygroup.SecuritygroupServiceImpl">
<property name="securitygroupDao"
ref="securitygroupDao" />
</bean>



<!-- ******************** action bean **************************** -->
<bean id="login" class="com.flight.struts.LoginAction">
<property name="userService" ref="userService"></property>
</bean>
<bean id="showOrder" class="com.flight.struts.showOrderAction">
<property name="orderService" ref="orderService"></property>
</bean>
<bean id="orderTreatMent" class="com.flight.struts.OrderTreatMentAction">
<property name="orderService" ref="orderService"></property>
</bean>
<bean id="updateFlightSegment" class="com.flight.struts.UpdateFlightSegmentAction">
<property name="flightSegmentService" ref="flightSegmentService"></property>
</bean>
<bean id="updateOrder" class="com.flight.struts.UpdateOrderAction">
<property name="orderService" ref="orderService"></property>

</bean>
<bean id="cancel" class="com.flight.struts.CancelAction">
</bean>
<!-- user action bean -->
<bean id="userAction" class="com.flight.struts.UserAction">
<property name="userService" ref="userService"></property>
</bean>
<bean id="addUserAction" class="com.flight.struts.AddUserAction">
<property name="userService" ref="userService"></property>
<property name="partyService" ref="partyService"></property>
</bean>
<bean id="deleteUserAction" class="com.flight.struts.DeleteUserAction">
<property name="userService" ref="userService"></property>
</bean>

<bean id="updateUserAction" class="com.flight.struts.UpdateUserAction">
<property name="userService" ref="userService"></property>
</bean>
<!-- ******************** systemmanage action bean **************************** -->
<bean id="empAction" class="com.flight.struts.EmpAction">
<property name="empService" ref="empservice"></property>
</bean>
<bean id="addEmpAction" class="com.flight.struts.AddEmpAction">
<property name="userService" ref="userService"></property>
<property name="partyService" ref="partyService"></property>
<property name="companyService" ref="companyService"></property>
<property name="departmentService" ref="departmentService"></property>
<property name="empService" ref="empservice"></property>
</bean>
<bean id="findDeptAction" class="com.flight.struts.FindDeptAction">
<property name="companyService" ref="companyService"></property>
</bean>
<bean id="deleteEmpAction" class="com.flight.struts.DeleteEmpAction">
<property name="partyService" ref="partyService"></property>
</bean>
<bean id="updateEmpAction" class="com.flight.struts.UpdateEmpAction">
<property name="userService" ref="userService"></property>
<property name="partyService" ref="partyService"></property>
<property name="companyService" ref="companyService"></property>
<property name="departmentService" ref="departmentService"></property>
</bean>

<bean id="companyAction" class="com.flight.struts.CompanyAction">
<property name="companyService" ref="companyService"></property>
</bean>

<bean id="addCompanyAction" class="com.flight.struts.AddCompanyAction">
<property name="companyService" ref="companyService"></property>
</bean>

<bean id="deleteCompanyAction" class="com.flight.struts.DeleteCompanyAction">
<property name="companyService" ref="companyService"></property>
</bean>
<bean id="updateCompanyAction" class="com.flight.struts.UpdateCompanyAction">
<property name="companyService" ref="companyService"></property>
</bean>
<bean id="deptAction" class="com.flight.struts.DeptAction">
<property name="departmentService" ref="departmentService"></property>
</bean>
<bean id="addDeptAction" class="com.flight.struts.AddDeptAction">
<property name="departmentService" ref="departmentService"></property>
<property name="companyService" ref="companyService"></property>
</bean>
<bean id="updateDeptAction" class="com.flight.struts.UpdateDeptAction">
<property name="departmentService" ref="departmentService"></property>
<property name="companyService" ref="companyService"></property>
</bean>
<bean id="deleteDeptAction" class="com.flight.struts.DeleteDeptAction">
<property name="departmentService" ref="departmentService"></property>

</bean>

<bean id="SgAction" class="com.flight.struts.SecuritygroupAction">
<property name="securitygroupService" ref="securitygroupService"></property>

</bean>
<bean id="addSgAction" class="com.flight.struts.AddSecuritygroupAction">
<property name="securitygroupService" ref="securitygroupService"></property>

</bean>
<bean id="deleteSgAction" class="com.flight.struts.DeleteSecuritygroupAction">
<property name="securitygroupService" ref="securitygroupService"></property>

</bean>
<bean id="updateSgAction" class="com.flight.struts.UpdateSecuritygroupAction">
<property name="securitygroupService" ref="securitygroupService"></property>

</bean>

</beans>
pangyunlong 2010-05-14
  • 打赏
  • 举报
回复
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<!-- 初始化spring信息 -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>

<!-- 加载struts2 -->
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>



<!-- Log4j -->
<listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>
<!-- Spring -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>





<filter-mapping>

<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

<jsp-config>
<jsp-property-group>
<description>
Special property group for JSP Configuration JSP
example.
</description>
<display-name>JSPConfiguration</display-name>
<url-pattern>*.jsp</url-pattern>
<el-ignored>false</el-ignored>
<page-encoding>UTF-8</page-encoding>
<scripting-invalid>false</scripting-invalid>
<include-prelude></include-prelude>
<include-coda></include-coda>
</jsp-property-group>

<jsp-property-group>
<description>
Special property group for JSP Configuration JSP
example.
</description>
<display-name>JSPConfiguration</display-name>
<url-pattern>*.html</url-pattern>
<el-ignored>false</el-ignored>
<page-encoding>UTF-8</page-encoding>
<scripting-invalid>false</scripting-invalid>
<include-prelude></include-prelude>
<include-coda></include-coda>
</jsp-property-group>
</jsp-config>

<welcome-file-list>
<welcome-file>homepage.jsp</welcome-file>
</welcome-file-list>

</web-app>
ktbaby 2010-05-14
  • 打赏
  • 举报
回复
你用MyEclipse可以自动生成

67,516

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧