具体工程会上传文件sshpro

<?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" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"id="WebApp_ID" version="2.5"><servlet><servlet-name>HelloServlet</servlet-name><servlet-class>hello.HelloServlet</servlet-class></servlet><servlet-mapping><servlet-name>HelloServlet</servlet-name><url-pattern>/hello</url-pattern></servlet-mapping><!-- 配置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><!-- 配置spring监听器 --><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><welcome-file-list><welcome-file>index.html</welcome-file><welcome-file>index.htm</welcome-file><welcome-file>index.jsp</welcome-file><welcome-file>default.html</welcome-file><welcome-file>default.htm</welcome-file><welcome-file>default.jsp</welcome-file></welcome-file-list></web-app>

<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"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd http://www.springframework.org/schema/tx  http://www.springframework.org/schema/tx/spring-tx.xsd"><!-- 数据库连接池 --><bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"><property name="driverClass" value="com.mysql.jdbc.Driver" /><property name="jdbcUrl" value="jdbc:mysql://localhost:3306/maven" /><property name="user" value="root" /><property name="password" value="123456" /></bean><!-- 配置sessionFactory --><bean id="sessionFactory"class="org.springframework.orm.hibernate5.LocalSessionFactoryBean"><!-- 依赖dataSource --><property name="dataSource" ref="dataSource" /><!-- 创建工厂需要加载hibernate映射文件 --><property name="configLocations" value="classpath:hibernate.cfg.xml"></property></bean><bean id="customerDao" class="customerDaoImpl.CustomerImpl"><property name="sessionFactory" ref="sessionFactory"></property></bean><bean id="customerService" class="customerServiceImpl.CustomerServiceImpl"><property name="customerDao" ref="customerDao"></property></bean><bean id="customerAction" class="customerAction.CustomerAction"><property name="customerService" ref="customerService"></property></bean></beans>

<?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><!-- 配置常量 --><!-- 字符集 --><constant name="struts.i18n.encoding" value="UTF-8"></constant><!-- 开发模式 --><constant name="struts.devMode" value="true"></constant><!-- 主题 --><constant name="struts.ui.theme" value="simple"></constant><!-- 扩展名 --><constant name="struts.action.extension" value="action,,"></constant><!-- 通用package --><package name="customer" namespace="/" extends="struts-default"><action name="CustomerAction_*" class="customerAction" method="{1}"><result name="success">/success.jsp</result></action></package>
</struts>

<?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="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</property><!--为了方便调试是否在运行hibernate时在日志中输出sql语句 --><property name="hibernate.show_sql">true</property><!-- 是否对日志中输出的sql语句进行格式化 --><property name="hibernate.format_sql">true</property><property name="hibernate.hbm2ddl.auto">update</property><property name="current_session_context_class">thread</property><!-- 加载映射文件 --><mapping resource="domain/Customer.hbm.xml"/></session-factory></hibernate-configuration>

文件结构图:

package domain;public class Customer {private Long custId;private String custName;private Long custUserId;private Long custCreateId;private String custIndustry;private String custLevel;private String custLinkman;private String custPhone;private String custMobile;public Long getCustId() {return custId;}public void setCustId(Long custId) {this.custId = custId;}public String getCustName() {return custName;}public void setCustName(String custName) {this.custName = custName;}public Long getCustUserId() {return custUserId;}public void setCustUserId(Long custUserId) {this.custUserId = custUserId;}public Long getCustCreateId() {return custCreateId;}public void setCustCreateId(Long custCreateId) {this.custCreateId = custCreateId;}public String getCustIndustry() {return custIndustry;}public void setCustIndustry(String custIndustry) {this.custIndustry = custIndustry;}public String getCustLevel() {return custLevel;}public void setCustLevel(String custLevel) {this.custLevel = custLevel;}public String getCustLinkman() {return custLinkman;}public void setCustLinkman(String custLinkman) {this.custLinkman = custLinkman;}public String getCustPhone() {return custPhone;}public void setCustPhone(String custPhone) {this.custPhone = custPhone;}public String getCustMobile() {return custMobile;}public void setCustMobile(String custMobile) {this.custMobile = custMobile;}/* (non-Javadoc)* @see java.lang.Object#toString()*/@Overridepublic String toString() {return "Customer [custId=" + custId + ", custName=" + custName+ ", custUserId=" + custUserId + ", custCreateId="+ custCreateId + ", custIndustry=" + custIndustry+ ", custLevel=" + custLevel + ", custLinkman=" + custLinkman+ ", custPhone=" + custPhone + ", custMobile=" + custMobile+ "]";}}

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<!-- Generated 2016-2-26 16:58:40 by Hibernate Tools 4.3.1.Final -->
<hibernate-mapping><class name="domain.Customer" table="cst_customer"  optimistic-lock="version"><id name="custId" type="java.lang.Long"><column name="cust_id" /><generator class="identity" /></id><property name="custName" type="string"><column name="cust_name" length="32" not-null="true"></column></property><property name="custUserId" type="java.lang.Long"><column name="cust_user_id"></column></property><property name="custCreateId" type="java.lang.Long"><column name="cust_create_id"></column></property><property name="custIndustry" type="string"><column name="cust_industry" length="32"></column></property><property name="custLevel" type="string"><column name="cust_level" length="32"></column></property><property name="custLinkman" type="string"><column name="cust_linkman" length="64"></column></property><property name="custPhone" type="string"><column name="cust_phone" length="64"></column></property><property name="custMobile" type="string"><column name="cust_mobile" length="16"></column></property></class>
</hibernate-mapping>

package customerAction;import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;import customerService.CustomerService;
import domain.Customer;public class CustomerAction extends ActionSupport{private String id;private CustomerService customerService;private Customer customer;public CustomerService getCustomerService() {return customerService;}public void setCustomerService(CustomerService customerService) {this.customerService = customerService;}public String getId() {return id;} public void setId(String id) {this.id = id;}public String findCustomerByid(){System.out.println("查询用户的id:"+id);customer = customerService.findById(Long.parseLong(id));ActionContext.getContext().getValueStack().push(customer);return "success";}}

package customerServiceImpl;import customerDao.CustomerDao;
import customerService.CustomerService;
import domain.Customer;public class CustomerServiceImpl implements CustomerService{private CustomerDao customerDao;public CustomerDao getCustomerDao() {return customerDao;}public void setCustomerDao(CustomerDao customerDao) {this.customerDao = customerDao;}@Overridepublic Customer findById(Long id) {// TODO Auto-generated method stubCustomer c = customerDao.findById(id);return c;}}

package customerDaoImpl;import org.hibernate.Session;
import org.hibernate.SessionFactory;import customerDao.CustomerDao;
import domain.Customer;public class CustomerImpl implements CustomerDao {private SessionFactory sessionFactory;public SessionFactory getSessionFactory() {return sessionFactory;}public void setSessionFactory(SessionFactory sessionFactory) {this.sessionFactory = sessionFactory;}@Overridepublic Customer findById(Long id) {// TODO Auto-generated method stubSession session = this.getSessionFactory().openSession();Customer customer = session.get(Customer.class, id);session.close();return customer;}}

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><groupId>cn.xw.com</groupId><artifactId>sshpro</artifactId><version>0.0.1-SNAPSHOT</version><packaging>war</packaging><name>sshpro</name><description>maven整合ssh</description><!-- 属性 --><properties><spring.version>4.2.4.RELEASE</spring.version><hibernate.version>5.0.7.Final</hibernate.version><struts.version>2.3.24</struts.version></properties><!-- 锁定版本,struts2-2.3.24、spring4.2.4、hibernate5.0.7 --><dependencyManagement><dependencies><dependency><groupId>org.springframework</groupId><artifactId>spring-context</artifactId><version>${spring.version}</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-aspects</artifactId><version>${spring.version}</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-orm</artifactId><version>${spring.version}</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-test</artifactId><version>${spring.version}</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-web</artifactId><version>${spring.version}</version></dependency><dependency><groupId>org.hibernate</groupId><artifactId>hibernate-core</artifactId><version>${hibernate.version}</version></dependency><dependency><groupId>org.apache.struts</groupId><artifactId>struts2-core</artifactId><version>${struts.version}</version></dependency><dependency><groupId>org.apache.struts</groupId><artifactId>struts2-spring-plugin</artifactId><version>${struts.version}</version></dependency></dependencies></dependencyManagement><!-- 依赖管理 --><dependencies><!-- spring --><dependency><groupId>org.springframework</groupId><artifactId>spring-context</artifactId></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-aspects</artifactId></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-orm</artifactId></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-test</artifactId></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-web</artifactId></dependency><!-- hibernate --><dependency><groupId>org.hibernate</groupId><artifactId>hibernate-core</artifactId></dependency><!-- 数据库驱动 --><dependency><groupId>mysql</groupId><artifactId>mysql-connector-java</artifactId><version>5.1.6</version><scope>runtime</scope></dependency><!-- c3p0 --><dependency><groupId>c3p0</groupId><artifactId>c3p0</artifactId><version>0.9.1.2</version></dependency><!-- 导入 struts2 --><dependency><groupId>org.apache.struts</groupId><artifactId>struts2-core</artifactId></dependency><dependency><groupId>org.apache.struts</groupId><artifactId>struts2-spring-plugin</artifactId></dependency><!-- servlet jsp --><dependency><groupId>javax.servlet</groupId><artifactId>servlet-api</artifactId><version>2.5</version><scope>provided</scope></dependency><dependency><groupId>javax.servlet</groupId><artifactId>jsp-api</artifactId><version>2.0</version><scope>provided</scope></dependency><!-- 日志 --><dependency><groupId>org.slf4j</groupId><artifactId>slf4j-log4j12</artifactId><version>1.7.2</version></dependency><!-- junit --><dependency><groupId>junit</groupId><artifactId>junit</artifactId><version>4.9</version><scope>test</scope></dependency><!-- jstl --><dependency><groupId>javax.servlet</groupId><artifactId>jstl</artifactId><version>1.2</version></dependency></dependencies><build><plugins><!-- 设置编译版本为1.7 --><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><configuration><source>1.7</source><target>1.7</target><encoding>UTF-8</encoding></configuration></plugin><!-- maven内置 的tomcat6插件 --><plugin><groupId>org.codehaus.mojo</groupId><artifactId>tomcat-maven-plugin</artifactId><version>1.1</version><configuration><!-- 可以灵活配置工程路径 --><path>/ssh</path><!-- 可以灵活配置端口号 --><port>8080</port></configuration></plugin></plugins></build></project>

转载于:https://www.cnblogs.com/Danial7777777/p/9163589.html

maven整合ssh框架笔记相关推荐

  1. 使用maven整合SSH框架详细步骤

    (文章所使用的的框架为Struts2+Spring+Hibernate,项目的结构图参照文章尾部) 1.第一步:创建maven工程,在pom.xml文件中导入需要的jar包依赖: <projec ...

  2. IDEA用maven整合ssh框架

    2019独角兽企业重金招聘Python工程师标准>>> web.xml配置 <?xml version="1.0" encoding="UTF-8 ...

  3. 使用IDEA和Maven整合SSH

    使用IDEA和Maven整合SSH SSH介绍 开发工具 整合SSH 一.准备数据库 二.创建项目 1.使用maven快速创建web工程 2.建包,创建配置文件模版 3.引入项目所需jar文件 4.编 ...

  4. idea 使用 maven 整合 ssm 框架 实现简单的增、删、改 和 分页查询功能

    详细请参考:   idea 使用 maven 整合 ssm 框架 文章目录 ==效果图== ==准备数据库== ==创建maven项目== ==配置文件== pom.xml jdbc.properti ...

  5. myeclipse使用maven整合ssh配置

    最近写项目,由于公司需求,使用myeclispe来开发maven项目,关于maven就不再介绍,无论是jar包管理功能,还是作为版本构建工具,优点自然是很多,下面先贴出所需要的配置文件. maven所 ...

  6. 基于maven的ssh框架一步一步搭建(一)

    一.新建maven项目,配置ssh框架pom的最低支持 1.新建一个maven项目 2.添加一个web.xml ? 1 2 3 4 5 6 7 8 9 <?xml version="1 ...

  7. 浅谈IDEA+Maven 整合SSM框架实现简单的增删改查

    SSM SSM(Spring+SpringMVC+MyBatis)框架集由Spring.MyBatis两个开源框架整合而成(SpringMVC是Spring中的部分内容).常作为数据源较简单的web项 ...

  8. 基于Maven的SSH框架搭建

    2019独角兽企业重金招聘Python工程师标准>>> 1.工程介绍 工程是结合了Spring+struts2+hibernate,实现了一个简单的form表单提交的功能,可能需要对 ...

  9. idea 使用maven 整合ssm框架

    创建 maven 项目 刚创建好的 maven 项目结构 整合 SSM 框架后的项目结构 数据库环境 创建 mybatis 数据库,在 mybatis 数据库中创建 teacher 数据库表,然后在 ...

  10. Maven整合SSM框架(maven+spring+springmvc+mybatis)

    啊哈,终于到了用Maven整合SSM这个扑街含家产了.弄了整整一天才跑通.Mybatis的配置有些繁琐,跟之前学习的那个有点出去,加上Eclipse的Spring工具没有弄,配置的时候没有提示被搞蒙圈 ...

最新文章

  1. 2021年大数据Hive(七):Hive的开窗函数
  2. python实现客户端和服务器端传输图片
  3. 【普及组模拟赛】手机
  4. 知识图谱数据构建的“硬骨头”,阿里工程师如何拿下?
  5. 语句 查询每个人每个科目的最高分_转行数据分析师专栏(SQL篇)-05多表查询...
  6. c语言随机抽取小程序_C语言整人小程序,慎用,谨记!
  7. Linux程序包管理2
  8. STM32 ESP8266和Java服务器透传模式下的双向通信
  9. PHP微信H5支付Demo
  10. 论文文献引用格式总结整理
  11. loadrunner教程系列
  12. 2009年英国大学综合排名
  13. 新注册的邮箱如何群发邮件
  14. ORA -09925
  15. 本硕博都有在马来亚大学读书是一种什么体验?
  16. 针对e场景活动发布网站使用及产品介绍
  17. 更换固态硬盘(不重装系统)(2)
  18. 《Android Studio开发实战》学习(五) - 截图
  19. idea maven路径总是自己改成默认的路径C:\Users\Ad\.m2\repository
  20. 对ActiveX控件进行注册

热门文章

  1. 金蝶k3安装详细步骤_ug安装教程详细步骤ug怎么免费安装教程ug软件怎样安装步骤...
  2. 区块链 预言机 Oracle是什么 例子
  3. thinkphp 访问根目录文件
  4. oracle同时删除一行数据,oracle 多表删除 同时删除多表中关联数据
  5. java双向链表结构_【Java数据结构】2.3双向链表的迭代实现
  6. 创业阶段如何找客户_如何找创业合伙人
  7. JDBC13 ORM02 Map封装
  8. 直线度误差 matlab,基于MATLAB的直线度误差数据处理
  9. 动画效果之手机端实现垃圾桶效果
  10. BFS解决连同块问题