ssh开源框架日志心得.doc_第1页
ssh开源框架日志心得.doc_第2页
ssh开源框架日志心得.doc_第3页
ssh开源框架日志心得.doc_第4页
ssh开源框架日志心得.doc_第5页
已阅读5页,还剩1页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

-2、c.f:filter、interceptor、aop-1、spring orm插件支持hibernate,是因为前者用到后者的类;struts2-spring插件支持spring,是因为前者用到后者的类。在上面基础上,用相应的配置(文件)描述框架加载及运行中的这种支持0、struts2在哪里指定spring创建action为多例?在哪里指定不用spring时action亦为多例?Interceptor?1、spring装配策略 default-autowire=byName,分别在applicationContext.xml、applicationContext-dao.xml、applicationContext-service.xml写与不写的区别2、spring中dao、service单例,在项目加载时创建;Action多例,每次请求创建(项目加载时不创建)3、(1)sessionFactory:在DAO中,因为public class SortDAOImpl extends HibernateDaoSupport implements SortDAO public abstract class HibernateDaoSupport extends DaoSupport private HibernateTemplate hibernateTemplate;public final void setSessionFactory(SessionFactory sessionFactory) if (this.hibernateTemplate = null | sessionFactory != this.hibernateTemplate.getSessionFactory() this.hibernateTemplate = createHibernateTemplate(sessionFactory);protected HibernateTemplate createHibernateTemplate(SessionFactory sessionFactory) return new HibernateTemplate(sessionFactory);public final SessionFactory getSessionFactory() return (this.hibernateTemplate != null ? this.hibernateTemplate.getSessionFactory() : null);public final void setHibernateTemplate(HibernateTemplate hibernateTemplate) this.hibernateTemplate = hibernateTemplate;public final HibernateTemplate getHibernateTemplate() return this.hibernateTemplate;protected final void checkDaoConfig() if (this.hibernateTemplate = null) throw new IllegalArgumentException(sessionFactory or hibernateTemplate is required);protected final Session getSession() throws DataAccessResourceFailureException, IllegalStateException return getSession(this.hibernateTemplate.isAllowCreate();protected final Session getSession(boolean allowCreate) throws DataAccessResourceFailureException, IllegalStateException return (!allowCreate ? SessionFactoryUtils.getSession(getSessionFactory(), false) :SessionFactoryUtils.getSession(getSessionFactory(),this.hibernateTemplate.getEntityInterceptor(),this.hibernateTemplate.getJdbcExceptionTranslator();protected final DataAccessException convertHibernateAccessException(HibernateException ex) return this.hibernateTemplate.convertHibernateAccessException(ex);protected final void releaseSession(Session session) SessionFactoryUtils.releaseSession(session, getSessionFactory();(2)configLocation用于构造set方法反射执行public class ContextLoaderListener implements ServletContextListener 4、package、import编译后进入全路径,即.class不存package、import:5、ssh2如何咬合在一起?ssh2工作流程web.xml-applicationContext*.xml-hibernate.cfg.xml-*.hbm.xml -struts.xml每一个框架都有一个框架级的配置文件web.xml-ContextLoaderListener -StrutsPrepareAndExecuteFilterHibernate由spring管理,在applicationContext.xml sessionFactory(为org.springframework.orm.hibernate3.LocalSessionFactoryBean的实例)指定struts2 的action由spring管理,在struts2-spring-plugin-.jar-struts-plugin.xml: 指定理解配置文件【spring】装配策略依赖注入/控制反转事务AOPSpring容器手工获取bean【hibernate】缓存延迟加载:cglib如何动态代理pojo?inversePO=POJO+*.hbm.xmlORMSessionFactoryHibernateDaoSupport/HibernanteTemplateCriteriaCachec3p0分页annotation(EJB3)【struts2】struts2配置文件struts2-core-.jar-org.apache.struts2 pertiesstruts2-core-.jar-struts-default.xmlstruts2-spring-plugin-.jar-struts-plugin.xml装配策略(c.f spring): struts2-core-.jar-org.apache.struts2 perties:# specifies the autoWiring logic when using the SpringObjectFactory.# valid values are: name, type, auto, and constructor (name is the default)struts.objectFactory.spring.autoWire = namestruts.action.extension=action,struts2/ssh2工作流程StrutsPrepareAndExecuteFilter(核心控制器)Interceptor(拦截器)原理ValueStack(值栈)OGNLnamespace(命名空间)ThreadLocalJava设计模式:工厂模式、单例/多例模式、代理模式、策略模式Jsp自定义标记库理解所有其他标记库(了解)hibernate 主键生成策略/11958153_d.htmlhibernate 主键生成策略有三种:序列 自增 通用1、序列 sequence 只能在oracle 和 DB2中使用 2、自增 identity 智能在sqlserver 和 mysq

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论