ssh 的搭建
struts包的下载:http://struts.apache.org/download.cgi#struts252
string包的下载:
http://repo.spring.io/release/org/springframework/spring/%20
hibernate包的下载:http://hibernate.org/orm/
一、先下载好包
二、创建一个项目text

三、导入struts2 和spring


然后编辑xml
struts的版本是2.3.3的
<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>
</filter-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>
编写一个struts.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">
<!-- 上面的头,注意版本,从样例里复制过来 showcase.war\WEB-INF\src\java\struts.xml --> <struts> <package name="mypck001" extends="struts-default"> <action name="Index" class="myIndexAction" method="execute1">
<result name="success">/WEB-INF/jsp/index2.jsp</result>
<result name="error">/WEB-INF/jsp/s_tag.jsp</result>
</action>
</package>
</struts>
<?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">
<!-- 上面的头,注意版本,从样例里复制过来 showcase.war\WEB-INF\src\java\struts.xml --> <!-- include文件用于分割,实现多人并发不冲突 -->
<struts>
<!-- 告知Struts2运行时使用Spring来创建对象 -->
<constant name="struts.objectFactory" value="spring" />
<include file="s001.xml" />
<include file="s002.xml" />
<include file="s003.xml" />
</struts>
然后添加src下创建applicationContext.xml
<?xml version="1.0" encoding="UTF-8"?>
<!--头信息,注意你的spring版本号 -->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.2.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.2.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.2.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-4.2.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.2.xsd">
在里面配置以下代码
<bean id="myIndexAction" class="ssh.action.IndexAction" scope="prototype">
<!-- setIs(myIndexService) -->
<property name="is" ref="myIndexService"/>
</bean> <!-- myIndexService = new ssh.service.IndexServiceImpl() -->
<bean id="myIndexService" class="ssh.service.IndexServiceImpl" scope="prototype">
<property name="id" ref="myIndexDao"/>
</bean> <bean id="myIndexDao" class="ssh.dao.IndexDaoImpl" scope="prototype">
<property name="c" ref="myConnection"></property>
</bean> <bean id="myConnection" class="ssh.util.MyConnectionImpl_SQLSERVER" scope="prototype">
</bean>
配置hibernate代码
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"> <hibernate-configuration>
<session-factory>
<property name="connection.driver_class">com.microsoft.sqlserver.jdbc.SQLServerDriver</property>
<property name="connection.url">jdbc:sqlserver://localhost:1433;DatabaseName=CardDB</property>
<property name="connection.username">sa</property>
<property name="connection.password"></property>
<!-- 每个数据库都有1个 -->
<property name="dialect">org.hibernate.dialect.SQLServer2008Dialect</property>
<property name="connection.pool_size">5</property>
<property name="show_sql">true</property>
<property name="format_sql">true</property>
<property name="hbm2dll.auto">update</property>
</session-factory>
</hibernate-configuration>
框架基本搭建完成。
ssh 的搭建的更多相关文章
- 【Java EE 学习 69 中】【数据采集系统第一天】【SSH框架搭建】
经过23天的艰苦斗争,终于搞定了数据采集系统~徐培成老师很厉害啊,明明只是用了10天就搞定的项目我却做了23天,还是模仿的...呵呵,算了,总之最后总算是完成了,现在该好好整理该项目了. 第一天的内容 ...
- ssh框架搭建的基本步骤(以及各部分作用)
ssh框架搭建的基本步骤(以及各部分作用) 一.首先,明确spring,struts,hibernate在环境中各自的作用. struts: 用来响应用户的action,对应到相应的类进行 ...
- SSH环境搭建步骤解析
一.建立Java web project:AngelSSH 二.引入jar包,必要清单如下 2.1,Struts2 commons-fileupload 文件上传组件 commons-io io ...
- 基于MyEclipse+9.0+++Tomcat+7.0的SSH+平台搭建
基于MyEclipse+9.0+++Tomcat+7.0的SSH+平台搭建 http://wenku.baidu.com/view/96fbfe0f581b6bd97f19ea1d.html 用MyE ...
- 转 SSH框架搭建详细图文教程
原址:http://blog.sina.com.cn/s/blog_a6a6b3cd01017c57.html 什么是SSH? SSH对应 struts spring hibernatestruts ...
- SSH框架搭建 详细图文教程
转载请标明原文地址 一.什么是SSH? SSH是JavaEE中三种框架(Struts+Spring+Hibernate)的集成框架,是目前比较流行的一种Java Web开源框架. SSH主要用于Jav ...
- Linux笔记③(ftp、nfs、ssh服务器搭建)
1.ftp服务器搭建(利用vsftpd这个工具) 作用:文件的上传和下载 服务器端: 修改配置文件,配置文件目录:/etc/vsftpd.conf ,修改里面的允许匿名访问.指定匿名访问目录等操作,根 ...
- SSH框架搭建详细图文教程(转)
这篇文章看的我醍醐灌顶的感觉,比之前本科时候学习的SSH架构 要清晰数倍 非常感觉这篇博主的文章 文章链接为:http://blog.sina.com.cn/s/blog_a6a6b3cd01017 ...
- SSH框架搭建步骤总结以及Hibernate二级缓存,查询缓存
二级缓存.查询缓存 一级缓存: 默认启动,生命周期是和session同步的,session独享 二级缓存: 需要加载配置信息,生命周期是和应用服务器同步,session共享 1:在hibernate. ...
- SSH框架搭建详细图文教程
转载请标明原文地址:http://www.cnblogs.com/zhangyukof/p/6762554.html 一.什么是SSH? SSH是JavaEE中三种框架(Struts+Spring+H ...
随机推荐
- select,poll,epoll区别
select:忙轮询,一直在轮询,效率跟链接数成反比,资源限制 poll:轮询,不用一直轮询,有事件触发时轮询,资源限制 epoll:有事件触发时直接通知复杂度O(1)
- Linear Algebra lecture 2 note
Lecture2 Elimination Inverses Permutation 消元法介绍(elimination): 有方程组 提取系数,形成矩阵为: 消元的思想跟解方程组中先消除未知数的思路一 ...
- ASP.NET Razor - C# 变量
变量是用来存储数据的命名实体. 变量 变量是用来存储数据的. 一个变量的名称必须以字母字符开头,并且不能包含空格或者保留字符. 一个变量可以是一个指定的类型,表示它所存储的数据类型.string 变量 ...
- AutoLearnSkills.lua --升级自动学习技能
--[[作者信息: Auto Learn SKills (升级自动学习技能) 作者QQ:247321453 作者Email:247321453@qq.com 修改日期:2014-3-12 功能:在玩家 ...
- edgesForExtendedLayout,automaticallyAdjustsScrollViewInsets, extendedLayoutIncludesOpaqueBars的影响
在IOS7以后 ViewController 开始使用全屏布局的,而且是默认的行为通常涉及到布局 就离不开这个属性 edgesForExtendedLayout,它是一个类型为UIExtendedEd ...
- MYCAT介绍(转)
从定义和分类来看,它是一个开源的分布式数据库系统,是一个实现了MySQL协议的服务器,前端用户可以把它看作是一个数据库代理,用MySQL客户端工具和命令行访问,而其后端可以用MySQL原生协议与多个M ...
- JConsole监控远程Tomcat服务器
为了解决内存溢出的问题,会用到一些监视内存的工具,jconsole这个工具在jdk1.7自带了.这个工具可以查看系统的堆,非堆,线程,等等的一些整体的情况,从而可以判断出系统的一个大概的性能情况. c ...
- [转]Windows 下的进程间通讯及数据共享
http://blog.codingnow.com/2005/10/interprocess_communications.html Windows 下有很多方法实现进程间通讯,比如用 socket, ...
- 关于FPGA学习路线
1.参考FPGA厂商的参考资料,将某系列FPGA所有芯片资料下载下来,有针对性的做参考. 2.参考FPGA厂商开发板以及相应的参考设计,在开发板里有众多的外围接口电路,基本涵盖了常用的应用场合.同时也 ...
- 常用Web Service汇总(天气预报、时刻表等)
现成的Web Service中有很多很好用的,比如天气预报,IP地址搜索,火车时刻表等等.本文汇总的一些常用Web Service,希望对大家有所帮助. AD: ================= ...