《基于Eclipse的SSH2搭建的设计与开》由会员分享,可在线阅读,更多相关《基于Eclipse的SSH2搭建的设计与开(19页珍藏版)》请在金锄头文库上搜索。
1、基于Eclipse的SSH2搭建 Struts2.3.4+spring3.1.1+hibernate3.6Ssh2+ extjs Tomcat启动错误严重: Unable to find parent packages json-default缺少包严重: Context initialization failedorg.springframework.beans.factory.BeanCreationException: Error creating bean with name adminDAOImpl defined in ServletContext resource /WEB-IN
2、F/applicationContext_beans.xml: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name sessionFactory defined in ServletContext resource /WEB-INF/applicationContext_common.xml: Invocation of init method failed; nested
3、 exception is org.hibernate.HibernateException: JDBC Driver class not found: com.mysql.jdbc.Driver缺少添加jar包1 Struts2.3.4 如下图2 在Web.xml里 struts2 org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter struts2 /* 3 src下添加 struts.xml !- -4 添加Spring3.1jar5 添加 Struts管理spring的插件插件包所在的位置6 添加 包
4、插件包所在的位置 7 web.xml里 org.springframework.web.context.ContextLoaderListener contextConfigLocation !- src目录下 classpath:applicationContext_*.xml - /WEB-INF/applicationContext_*.xml 8 WEB-INF 下添加applicationContext.xml9测试 新建index.jsp 和tt.jspindex.jsp的 body添加 建测试类TTTT.java内容package test;import com.opensymp
5、hony.xwork2.ActionSupport;public class TT extends ActionSupport private static final long serialVersionUID = 1L;public String test()System.out.println(TT test().);return tt;配置struts.xml /tt.jsp 配置 applicationContext.xml 10 添加hibernate3.6jar11 添加 mysql 驱动包12 src 目录 下添加 com.mysql.jdbc.Driverjdbc:mysql
6、:/yyltestroot org.hibernate.dialect.MySQL5Dialect !- 显示生成并执行的SQL语句 true-true !- 声明映射文件(.hbm.xml) 可以再spring的 sessionFactory指定目录集 - 13 Spring的AOP需要添加其他包和14 总结 Struts2.3.4+spring3.2+hibernate3.6的总jar包 15 ssh +extj4 1 web.xml s2.3.4s3.1h3.6 welcome- welcome- characterEncodingFilterorg.springframework.web.filter.CharacterEncodingFilter encoding utf-8 characterEncodingFilter /*