ssh框架搭建

下载地址:源码和详细搭建步骤

使用myeclipse2014搭建ssh框架

    • 1. spring搭建
    • 2. struts2搭建
    • 3. hibernate搭建
    • 4. applicationContext编写
    • 5. web.xml编写

1. spring搭建

  1. 创建一个javaweb项目

  2. 导入spring框架

  3. 最高版本3.1支持


4. 选择类库

spring导入完毕

2. struts2搭建

3. hibernate搭建



选择数据驱动

4. applicationContext编写

<?xml version="1.0" encoding="UTF-8"?>
<beansxmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:p="http://www.springframework.org/schema/p"xmlns:tx="http://www.springframework.org/schema/tx"xmlns:context="http://www.springframework.org/schema/context"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsdhttp://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsdhttp://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd"><!-- 注解ioc扫描 --><context:component-scan base-package="com.test" /><!-- <bean id="dataSource"class="org.apache.commons.dbcp.BasicDataSource"><property name="url"value="jdbc:mysql://localhost:3306/ssh_study"></property><property name="username" value="root"></property><property name="password" value="123456"></property></bean> --><!-- ComboPooledDataSource数据源配置 --><bean id="dataSource"class="com.mchange.v2.c3p0.ComboPooledDataSource"><property name="driverClass" value="com.mysql.jdbc.Driver"></property><property name="jdbcUrl"value="jdbc:mysql://localhost:3306/ssh_study"></property><property name="user" value="root"></property><property name="password" value="123456"></property></bean><!-- session工厂 --><bean id="sessionFactory"class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"><property name="dataSource"><ref bean="dataSource" /></property><property name="hibernateProperties"><props><prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop><!-- 展示sql --><prop key="hibernate.show_sql">true</prop><prop key="hibernate.format_sql">true</prop></props></property><property name="mappingResources"><list><value>com/test/entity/Users.hbm.xml</value></list></property></bean><!-- hibernate 模板 用来操作数据库 --><bean class="org.springframework.orm.hibernate3.HibernateTemplate"><property name="sessionFactory" ref="sessionFactory" /></bean><!-- 声明式事务管理器 --><bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"><property name="sessionFactory" ref="sessionFactory" /></bean><!-- 事务注解驱动 --><tx:annotation-driven transaction-manager="transactionManager"/><!-- action --><bean id="userAction" class="com.test.action.UserAction" scope="prototype"></bean></beans>

5. web.xml编写

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0"><display-name>ssh01</display-name><listener><listener-class>org.springframework.web.context.ContextLoaderListener</listener-class></listener><context-param><param-name>contextConfigLocation</param-name><param-value>classpath:applicationContext.xml</param-value></context-param><!-- 新增配置 openSessionViewFilter session的开关给它管理 --><filter><filter-name>openSessionInViewFilter</filter-name><filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class></filter><filter-mapping><filter-name>openSessionInViewFilter</filter-name><url-pattern>/*</url-pattern></filter-mapping><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>
</web-app>

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/420599.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

iOS: 图解Xcode常用的快捷键

对于习惯了Windows 操作的开发者来说&#xff0c; 初次接触Xcode时&#xff0c;你会感到有种种不适&#xff0c;其中一个重要的原因就是&#xff0c; 相比Windows X86 电脑&#xff0c; Mac 多出了两个物理键&#xff1a; Fn 和 Command。 尤其是 Command键&#xff0c;在 Ma…

vue参数传递

目标&#xff1a;纯前端vue实现页面跳转restful传值 目录1. 全局路由配置2. 如何传值3. 页面取值1. 全局路由配置 // 路由器主配置文件 import Vue from vue import VueRouter from vue-routerimport Main from ../views/main import Login from ../views/login// 导入用户模块…

adb——Android的ADB工具使用

一、定义与作用&#xff1a; ADB全称Android Debug Bridge, 就是起到调试桥的作用。是android sdk里的一个工具, 用这个工具可以直接操作管理android模拟器或者真实的andriod设备,默认情况下当我们运行Eclipse时adb进程就会自动运行。当然我们也可以在外部使用本身自带的一些命…

beforeRouteEnter,beforeRouteLeave函数

操作&#xff1a; 是时机函数&#xff0c;在页面加载前&#xff0c;可以在这两个函数里面做一些事情&#xff0c; 比如发送异步请求。 类似过滤器&#xff0c;或者拦截器。1. axios安装 安装报错&#xff0c;多装几遍&#xff0c;或者用cnpm安装 npm install axios -s npm in…

排错“未能封送类型,因为嵌入数组实例的长度与布局中声明的长度不匹配”...

问题&#xff1a;在C#给C传数组类型数据时报此错&#xff0c;相应英文信息为“Type could not be marshaled, because the length of an embed array doesnt not match the declared length in the layout” 原因1、声明的数组长度和实际的数组长度不一致&#xff0c;比如声明的…

a标签的href与onclick中使用js的区别

href与onclick中javascript的区别一般没用到都没注意&#xff0c;但出错时才有些郁闷&#xff0c;看文本章解释如下&#xff1a; 以前一直很随意&#xff0c;后来看.net里的linkbutton似乎是用在<a href"javascript:fun();"...>的形式&#xff0c;今天用这种方…

手把手教你搭建springboot程序

spring-boot项目搭建一、从官网搭建1、进入spring官网&#xff0c;快速初始化一个项目2、填写项目基本信息3、项目结构分析4、添加项目依赖5、下载到本地6、解压7、idea&#xff0c;打开&#xff0c;使用maven构建项目8、使用maven构建9、这是构建好的&#xff0c;其它目录全部…

jquery的鼠标移入移出事件hover、mouseenter、mouseleave、mouseover、mouseout

hover:鼠标进入元素的子元素时不会触发‘鼠标移开’的事件&#xff1b;mouseenter、mouseleave&#xff1a;效果与hover相同&#xff1b;mouseover&#xff1a; 鼠标进入元素和进入它的子元素时都会触发‘mouseover’的事件&#xff0c;即使添加了event.stopPropagation();retu…

yaml格式,给Java类绑定数据

这里写目录标题1、基本语法2、给java bean注入值3、测试1、基本语法 # yaml 配置文件写法&#xff0c;代替properties写法 # 严格区分空格# 内注入到配置类中 server:port: 8081# 对象 student:name: jackage: 3# 行内写法 map student1: {name: jack, age: 3}# array or coll…

android编程常见问题- Resource ID #0x7f070001 type #0x12 is not valid

问题说明&#xff1a; AndroidRuntime(1705): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.activitytest/com.example.activitytest.SecondActivity}: android.content.res.Resources$NotFoundException: Resource ID #0x7f070001 type #…

scm 软件配置管理

目录1、为什么需要使用SCM2、什么是SCM3、作用变更控制&#xff1a;版本控制的内容版本控制策略4、版本控制工具1、为什么需要使用SCM 1. 更改源文件&#xff0c;但不知道哪个是最新的&#xff1b; 2. 我不了解文件的修改过程&#xff0c;尤其是最后修改了哪几行以及为什么修改…

一款纯css3实现的超炫动画背画特效

之前为大家介绍了很多款由纯css3实现的特效。今天要再给大家带来一款纯css3实现的超炫动画背画特效。代码非常简单&#xff0c;没有引用任何其它js代码。css代码也不多。效果非常炫。一起看下效果图&#xff1a; 在线预览 源码下载 实现的代码。 html代码&#xff1a; <di…

springboot指定首页(静态资源导入)

ResourceProperties小小的源码分析1. 静态资源该放在哪里&#xff1f;2. 首页该如何自动展示&#xff1f;1. 静态资源该放在哪里&#xff1f; springboot 集成了spring-webmvc,这个都是知道的。 该框架的特点是自动装配。 先看WebMvcAutoConfiguration自动装配类 public void…

Mybatis日常操作遇到的问题

如果参数是一个基本类型&#xff08;不是一个类对象&#xff09;&#xff0c;在写sql需要对这个基本类型判断时&#xff0c;这个基本类型的名称必须是value,因为mybatis对于单个基本类型而言&#xff0c;默认名称是value&#xff0c;自定义的名称在用于if/when时&#xff0c;代…

log4j日志收集

目录1. log4j 是什么1. 日志管理工具2. 有哪些组成部分&#xff1f;3. 日志级别2. 输出端与日志格式化器Appender&#xff08;输出端&#xff09;Layout&#xff08;日志格式化器&#xff09;3. log4j.properties占位符&#xff0c;格式化日志4. 使用1. log4j 是什么 1. 日志管…

【从零之三(更)】自定义类中调用讯飞语音包错误解决办法

原文&#xff1a;http://blog.csdn.net/monkeyduck/article/details/24302655 在科大讯飞语音包的Mscdemo中它的方法都是写在Activity中的&#xff0c;这样其实并不是很好&#xff0c;因为Activity只是负责UI交互的&#xff0c;如果项目很简单自然可以&#xff0c;但是一旦比较…

php常用代码(一)

一&#xff1a;获取上个小时 方法1&#xff1a;date("H",strtotime("-1 hours"); 方法2&#xff1a;date(H,time()-60*60); 方法3&#xff1a;echo substr(0.(--date(H) & 23),-2); 转载于:https://www.cnblogs.com/Alight/p/3998203.html

spring 整合quartz

定时框架quartz1. 使用场景2. corn表达式3. 简单使用4. 注意点1. 使用场景 定时任务 周期性执行 &#xff08;每隔多长时间&#xff09; 定时执行&#xff08;每天几点&#xff09; 系统之间的数据交换 两个系统之间的数据 数据整理 报表打印… 2. corn表达式 corn 表达式…