ssh基本配置
来源:互联网 发布:淮南师范学院淘宝地址 编辑:程序博客网 时间:2024/06/06 02:59
一、配合web.xml
1、struts2核心过滤器
<!-- struts2的核心过滤器 --> <filter> <filter-name>struts2</filter-name> <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class> </filter> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/*</url-pattern> <dispatcher>REQUEST</dispatcher> <dispatcher>FORWARD</dispatcher> </filter-mapping>
2、spring监听器以及资源文件位置
<!-- spring的监听器 --> <!-- needed for ContextLoaderListener --><context-param><param-name>contextConfigLocation</param-name><param-value>classpath:applicationContext.xml</param-value></context-param><!-- Bootstraps the root web application context before servlet initialization --><listener><listener-class>org.springframework.web.context.ContextLoaderListener</listener-class></listener>
3、解决页面中hibernate延迟加载的nosession问题
<!-- 解决hibernate中的延迟加载nosession问题 --> <filter> <filter-name>OpenSessionFilter</filter-name> <filter-class>org.springframework.orm.hibernate5.support.OpenSessionInViewFilter</filter-class> </filter> <filter-mapping> <filter-name>OpenSessionFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>
二、struts2.xml文件
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN" "http://struts.apache.org/dtds/struts-2.3.dtd"><struts><!-- 模式 true控制台显示的信息多 false控制台显示的信息少 --><constant name="struts.devMode" value="false" /><!-- 使用spring整合 不配置也可以,因为整合包中已经有了这个配置 --><!-- <constant name="struts.objectFactory" value="spring"/> --><package name="basicstruts2" extends="struts-default"><!-- 需要进行权限控制的页面访问 --><action name="page_*_*"><result type="dispatcher">/WEB-INF/pages/{1}/{2}.jsp</result></action></package></struts>
三、log4j.properties日志文件,开发一般为debug模式,如果嫌日志信息太多,可关闭,改为off即可
### direct log messages to stdout ###log4j.appender.stdout=org.apache.log4j.ConsoleAppenderlog4j.appender.stdout.Target=System.errlog4j.appender.stdout.layout=org.apache.log4j.PatternLayoutlog4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n### direct messages to file mylog.log ###log4j.appender.file=org.apache.log4j.FileAppenderlog4j.appender.file.File=d:\\mylog.loglog4j.appender.file.layout=org.apache.log4j.PatternLayoutlog4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n### set log levels - for more verbose logging change 'info' to 'debug' ###### fatal error warn info debug tracelog4j.rootLogger=debug, file
四、配置applicationContext文件
<?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:context="http://www.springframework.org/schema/context"xmlns:aop="http://www.springframework.org/schema/aop"xmlns:tx="http://www.springframework.org/schema/tx"xmlns:jaxws="http://cxf.apache.org/jaxws"xmlns:soap="http://cxf.apache.org/bindings/soap"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsdhttp://www.springframework.org/schema/contexthttp://www.springframework.org/schema/context/spring-context.xsdhttp://www.springframework.org/schema/aophttp://www.springframework.org/schema/aop/spring-aop.xsdhttp://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsdhttp://cxf.apache.org/bindings/soap http://cxf.apache.org/schemas/configuration/soap.xsdhttp://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd"><!-- 加载属性文件 --><context:property-placeholder location="classpath:db.properties"/><!-- 加载数据源 --><bean name="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"><property name="driverClass" value="${jdbc.driverClass}"></property><property name="jdbcUrl" value="${jdbc.jdbcUrl}"></property><property name="user" value="${jdbc.user}"></property><property name="password" value="${jdbc.password}"></property></bean><!-- 配置LocalSessionFactoryBean spring用于提供整合hibernate的工厂bean --><bean id="sessionFactory" class="org.springframework.orm.hibernate5.LocalSessionFactoryBean"><property name="dataSource" ref="dataSource"></property><property name="hibernateProperties"><props><prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop><prop key="hibernate.hbm2ddl.auto">update</prop><prop key="hibernate.show_sql">true</prop><prop key="hibernate.format_sql">true</prop></props></property><!-- 注入bibernate的映射文件 --><property name="mappingLocations"><list><value>classpath:com/itheima/bos/domain/*.xml</value></list></property></bean><!-- 配置事务管理器 --><bean name="transactionManager" class="org.springframework.orm.hibernate5.HibernateTransactionManager"><property name="sessionFactory" ref="sessionFactory"></property></bean><!-- 开启注解扫描 --><context:component-scan base-package="com.itheima.bos"></context:component-scan><!-- 支持注解 --><context:annotation-config></context:annotation-config><!-- 事物注解 --><tx:annotation-driven/></beans>
阅读全文
0 0
- ssh基本配置
- ssh-环境基本配置
- 基本ssh框架配置
- JAVA SSH ----Struts基本配置
- 【1】SSH整合-基本环境配置
- 转SSH框架的基本配置
- unix下的ssh基本配置
- SSH中XM文件的基本配置
- linux下ssh的一些基本配置
- IntelliJ IDEA 中 ssh的基本配置
- 配置SSH所需jar包地址 + SSH实现分页功能+ SSH基本框架配置
- SSH 基本配置--OA系统的经典配置
- SSH 原理和基本使用:ssh 安全配置 以及ssh key 认证登录
- SSH原理和基本使用:ssh 安全配置 以及ssh key 认证登录
- 我的SSH项目之旅(1.基本配置)
- WRTnode的基本配置(ssh登录与连接Internet)
- SSH:Hibernate框架(关系映射及基本配置)
- [SSH框架初学笔记]web.xml文件的基本配置
- 提示框(新版)
- HDU 6092 Rikka with Subset (2017多校5-背包)
- UVAlive4490,状压DP的巧妙运用,注意边界
- Python_网络爬虫(新浪新闻抓取)
- 刷题——hdu 6082 ( 度度熊与邪恶大魔王 )
- ssh基本配置
- 背包问题九讲
- 【C++】输入输出
- 覆盖基类中的公有方法需要用new
- 【HDU 1159】 Common Subsequence(dp —lcs模板题)
- CentOS7没有eth0网卡
- 2017 Multi-University Training Contest 3 1005
- 技能冷却可以使用两张图片,改变一张图片的透明度
- Git 学习笔记(简介、安装、添加提交文件、查看状态及更改信息)