SSH+Oracle的整合(SSH与Oracle整合坑巨多)

这里用SSH+Oracle做一个仓库管理系统,其中包含了查询、条件查询、删除、批量删除、修改、添加的功能。值得注意的是,Oracle与其它数据库存在很多不同之处,所以SSH和Oracle整合的时候小细节处理稍有不慎,就要花费大量时间去排查,亲身体会!

下面进入正文 ↓↓↓↓

Oracle数据库:

goods.sql

注意:创建表的时候,无论表名大写小写,创建完成时都会默认设置成大写。

--创建仓库表
create table goods
(
       Gno number not null primary key, --编号
       gname varchar2(500) not null,  --物质名称
       gtype varchar2(20) not null,   --物质类型
       Gnumber number not null check (Gnumber > 0),       --物质数量
       Gcompany varchar2(500) not null, --生产商
       Gcreatetime date default sysdate,       --生产日期
       Uintime date default sysdate   --入库时间
);
drop table goods;
--创建自增序列
create sequence goods_id
increment by 1  --增量为1
start with 1    --从1开始生成序列
nomaxvalue;      --没有最大值

--插入数据
insert into goods(Gno,gname,gtype,gnumber,gcompany) values(goods_id.nextval,‘康师傅方便面‘,‘食品‘,‘150000‘,‘康师傅食品有限公司‘);
insert into goods(Gno,gname,gtype,gnumber,gcompany) values(goods_id.nextval,‘康师傅矿泉水‘,‘饮用水‘,‘150000‘,‘康师傅食品有限公司‘);
insert into goods(Gno,gname,gtype,gnumber,gcompany) values(goods_id.nextval,‘康师傅辣条‘,‘食品‘,‘150000‘,‘康师傅食品有限公司‘);
insert into goods(Gno,gname,gtype,gnumber,gcompany) values(goods_id.nextval,‘康师傅可乐‘,‘食品‘,‘150000‘,‘康师傅食品有限公司‘);
insert into goods(Gno,gname,gtype,gnumber,gcompany) values(goods_id.nextval,‘康师傅面包‘,‘食品‘,‘150000‘,‘康师傅食品有限公司‘);

select * from goods;

select * from goods order by gcreatetime desc;

commit;

SSH:

包结构:

idea中数据库插件配置:

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<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>com.hsl</groupId>
    <artifactId>Goods</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>war</packaging>

    <dependencies>
        <!--spring-->
        <!-- 这个依赖可以让spring容器有bean管理,依赖注入,基本的切面配置功能,但不支持切点表达式以及其解析-->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>5.0.2.RELEASE</version>
        </dependency>
        <!-- 让spring支持切点表达式功能-->
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjweaver</artifactId>
            <version>1.8.13</version>
        </dependency>
        <!-- 这个依赖是spring专门用来与其他持久层框架进行整合用的一个依赖里面有LocalSessionFactoryBean类型-->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-orm</artifactId>
            <version>5.0.2.RELEASE</version>
        </dependency>
        <!-- 此依赖有事务方面的通知,事务管理器等 -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-tx</artifactId>
            <version>5.0.2.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>5.0.2.RELEASE</version>
        </dependency>

        <!--hibernate-->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>5.2.10.Final</version>
        </dependency>

        <!--struts-->
        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-core</artifactId>
            <version>2.5.12</version>
        </dependency>
        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-spring-plugin</artifactId>
            <version>2.5.12</version>
        </dependency>

        <!--oracle-->
        <dependency>
            <groupId>com.oracle</groupId>
            <artifactId>ojdbc6</artifactId>
            <version>11.2.0.3</version>
        </dependency>

        <!-- 这是dbcp连接池依赖,完全可以换别的连接池组件-->
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-dbcp2</artifactId>
            <version>2.2.0</version>
        </dependency>

        <!--<dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
        </dependency>-->

    </dependencies>

    <build>
        <plugins>
            <!--用于设定源代码文件的编码,以及项目代码运行的目标jdk版本为1.8 -->
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
            <!-- 指定项目中web资源的根目录,用于maven打包时把此目录的所有内容拷贝到war中-->
            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.2</version>
                <configuration>
                    <warSourceDirectory>web</warSourceDirectory>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>

Goods.java

package entity;

import java.util.Date;

public class Goods {

    private int Gno ; //编号
    private String gname ;  //物质名称
    private String gtype ;  //物质类型
    private int Gnumber ;  //物质数量
    private String Gcompany ;  //生产商
    private Date Gcreatetime ;  //生产日期
    private Date Uintime ;  //入库时间

    public int getGno() {
        return Gno;
    }

    public void setGno(int gno) {
        Gno = gno;
    }

    public String getGname() {
        return gname;
    }

    public void setGname(String gname) {
        this.gname = gname;
    }

    public String getGtype() {
        return gtype;
    }

    public void setGtype(String gtype) {
        this.gtype = gtype;
    }

    public int getGnumber() {
        return Gnumber;
    }

    public void setGnumber(int gnumber) {
        Gnumber = gnumber;
    }

    public String getGcompany() {
        return Gcompany;
    }

    public void setGcompany(String gcompany) {
        Gcompany = gcompany;
    }

    public Date getGcreatetime() {
        return Gcreatetime;
    }

    public void setGcreatetime(Date gcreatetime) {
        Gcreatetime = gcreatetime;
    }

    public Date getUintime() {
        return Uintime;
    }

    public void setUintime(Date uintime) {
        Uintime = uintime;
    }
}

GoodsDao.java

package dao;

import entity.Goods;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.query.Query;

import java.util.Date;
import java.util.List;

public class GoodsDao {
    private SessionFactory sessionFactory;

    public SessionFactory getSessionFactory() {
        return sessionFactory;
    }

    public void setSessionFactory(SessionFactory sessionFactory) {
        this.sessionFactory = sessionFactory;
    }

    //查询全部
    public List<Goods> getAll(){
        Session session = sessionFactory.getCurrentSession();
        String sql = "from Goods as g order by g.Gcreatetime desc";
        return session.createQuery(sql).list();
    }

    //增加
    public void addGoods(Goods goods){
        Session session = sessionFactory.getCurrentSession();
        session.save(goods);
    }

    //删除
    public void delete(int Gno){
        Session session = sessionFactory.getCurrentSession();
        session.delete(session.get(Goods.class,Gno));
    }

    //根据编号查询
    public Goods getById(int Gno){
        Session session = sessionFactory.getCurrentSession();
        return session.get(Goods.class,Gno);
    }

    //修改
    public void update(Goods goods){
        Session session = sessionFactory.getCurrentSession();
        session.update(goods);
    }

    //按条件查询
    public List<Goods> getByTerm(String gname, Date firstTime,Date lastTime){
        Session session = sessionFactory.getCurrentSession();
        String hql = "from Goods g where g.gname like :gname and g.Gcreatetime between :firstTime and :lastTime";
        Query query = session.createQuery(hql);
        query.setParameter("gname","%"+gname+"%");
        query.setParameter("firstTime",firstTime);
        query.setParameter("lastTime",lastTime);
        return query.list();

    }

    //批量删除
    public void deleteAll(String[] Gno){
        Session session = sessionFactory.getCurrentSession();
        for(int i=0;i<Gno.length;i++){
            Goods goods = this.getById(Integer.parseInt(Gno[i]));
            session.delete(goods);
        }
    }

}

GoodsService.java

package service;

import dao.GoodsDao;
import entity.Goods;

import java.util.Date;
import java.util.List;

public class GoodsService {
    private GoodsDao goodsDao;

    public GoodsDao getGoodsDao() {
        return goodsDao;
    }

    public void setGoodsDao(GoodsDao goodsDao) {
        this.goodsDao = goodsDao;
    }

    public List<Goods> getAll(){
        return goodsDao.getAll();
    }

    public void addGoods(Goods goods){
        goodsDao.addGoods(goods);
    }

    public void delete(int Gno){
        goodsDao.delete(Gno);
    }

    public Goods getById(int Gno){
        return goodsDao.getById(Gno);
    }

    public void update(Goods goods){
        goodsDao.update(goods);
    }

    public List<Goods> getByTerm(String gname, Date firstTime, Date lastTime){
        return goodsDao.getByTerm(gname,firstTime,lastTime);
    }

    public void deleteAll(String[] Gno){
        goodsDao.deleteAll(Gno);
    }
}

GoodsController.java

package controller;

import com.opensymphony.xwork2.ActionContext;
import entity.Goods;
import service.GoodsService;

import java.util.Date;
import java.util.List;

public class GoodsController {
    private GoodsService goodsService;

    private Goods goods;

    private Date firstTime;
    private Date lastTime;
    private String Gnos;

    public String getGnos() {
        return Gnos;
    }

    public void setGnos(String gnos) {
        Gnos = gnos;
    }

    public Date getFirstTime() {
        return firstTime;
    }

    public void setFirstTime(Date firstTime) {
        this.firstTime = firstTime;
    }

    public Date getLastTime() {
        return lastTime;
    }

    public void setLastTime(Date lastTime) {
        this.lastTime = lastTime;
    }

    public Goods getGoods() {
        return goods;
    }

    public void setGoods(Goods goods) {
        this.goods = goods;
    }

    public GoodsService getGoodsService() {
        return goodsService;
    }

    public void setGoodsService(GoodsService goodsService) {
        this.goodsService = goodsService;
    }

    //查询全部
    public String list(){
        List<Goods> goods = goodsService.getAll();
        ActionContext.getContext().put("goods",goods);
        return "list";
    }
    //添加商品
    public String add(){
        goodsService.addGoods(goods);
        return "success";
    }
    //删除商品
    public String delete(){
        goodsService.delete(goods.getGno());
        return "success";
    }
    //批量删除
    public String deleteAll(){
        System.out.println(Gnos);
        String[] gnos = Gnos.split(",");
        goodsService.deleteAll(gnos);
        return "success";
    }
    //查询要修改的商品
    public String edit(){
        Goods goods1 = goodsService.getById(goods.getGno());
        ActionContext.getContext().put("goods1",goods1);
        return "edit";
    }
    //修改商品
    public String update(){
        goodsService.update(goods);
        return "success";
    }

    //按条件查询
    public String getByTerm(){
        List<Goods> goods2 = goodsService.getByTerm(goods.getGname(),firstTime,lastTime);
        ActionContext.getContext().put("goods",goods2);
        return "list";
    }
}

Goods.hbm.xml

注意:

  1.table需要写全称。

  2.dynamic-insert和dynamic-update表示是否启动默认值,如果没有设置true则数据库中默认的字段会为空。

  3.主键生成策略为increment,其它无效,不知道为什么。

<?xml version=‘1.0‘ encoding=‘utf-8‘?>
<!DOCTYPE hibernate-mapping PUBLIC
        "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
        "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="entity">

    <class name="entity.Goods" table="SCOTT.GOODS" dynamic-insert="true" dynamic-update="true" >
        <id name="Gno" column="Gno">
            <generator class="increment">
                <!--<param name="sequence">GOODS_ID</param>-->
            </generator>
        </id>
        <property name="gname" column="gname"/>
        <property name="gtype" column="gtype"/>
        <property name="Gnumber" column="Gnumber"/>
        <property name="Gcompany" column="Gcompany"/>
        <property name="Gcreatetime" column="Gcreatetime"/>
        <property name="uintime" column="uintime"/>
    </class>
</hibernate-mapping>

db.properties

url=jdbc:oracle:thin:@localhost:1521:orcl
driverclass=oracle.jdbc.driver.OracleDriver
username=SCOTT
password=tiger

applicationContext.xml

<?xml version="1.0" encoding="UTF-8"?>
<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:tx="http://www.springframework.org/schema/tx"
       xmlns:aop="http://www.springframework.org/schema/aop"
       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/tx
       http://www.springframework.org/schema/tx/spring-tx.xsd
       http://www.springframework.org/schema/aop
       http://www.springframework.org/schema/aop/spring-aop.xsd">

    <context:property-placeholder location="classpath:db.properties" local-override="true"/>
    <bean id="dataSource" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close">
        <property name="url" value="${url}"></property>
        <property name="driverClassName" value="${driverclass}"></property>
        <property name="username" value="${username}"></property>
        <property name="password" value="${password}"></property>

        <!--<property name="initialSize" value="5"></property>
        <property name="maxIdle" value="10"></property>
        <property name="maxTotal" value="10"></property>-->
    </bean>

    <bean id="sessionFactory" class="org.springframework.orm.hibernate5.LocalSessionFactoryBean" destroy-method="destroy">
        <property name="dataSource" ref="dataSource"></property>
        <property name="mappingLocations">
            <list>
                <value>classpath:Goods.hbm.xml</value>
            </list>
        </property>
        <property name="hibernateProperties">
            <props>
                <prop key="hibernate.show_sql">true</prop>
                <prop key="hibernate.format_sql">true</prop>
                <prop key="hibernate.dialect">org.hibernate.dialect.Oracle12cDialect</prop>
            </props>
        </property>
    </bean>

    <bean id="GoodsDao" class="dao.GoodsDao">
        <property name="sessionFactory" ref="sessionFactory"/>
    </bean>

    <bean id="transactionManager" class="org.springframework.orm.hibernate5.HibernateTransactionManager">
        <property name="sessionFactory" ref="sessionFactory"/>
    </bean>

    <tx:advice id="transactionInterceptor" transaction-manager="transactionManager">
        <tx:attributes>
            <tx:method name="get*" read-only="true"/>
            <tx:method name="delete*"/>
            <tx:method name="update*"/>
            <tx:method name="add*"/>
        </tx:attributes>
    </tx:advice>

    <aop:config>
        <aop:pointcut id="allServices"
                      expression="execution(public * service.*.*(..))"/>
        <aop:advisor advice-ref="transactionInterceptor" pointcut-ref="allServices"/>
    </aop:config>

    <bean id="goodsService" class="service.GoodsService">
        <property name="goodsDao" ref="GoodsDao"/>
    </bean>

    <bean id="goods" class="entity.Goods"/>

    <bean id="controller" class="controller.GoodsController">
        <property name="goodsService" ref="goodsService"/>
        <property name="goods" ref="goods"/>
    </bean>

</beans>

struts.xml

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE struts PUBLIC
        "-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
        "http://struts.apache.org/dtds/struts-2.5.dtd">

<struts>
    <package name="goods" extends="struts-default">
        <global-allowed-methods>list,add,delete,edit,update,getByTerm,deleteAll</global-allowed-methods>
        <action name="goods*" class="controller" method="{1}">
            <result name="list">index.jsp</result>
            <result name="success" type="redirectAction">goodslist</result>
            <result name="edit">edit.jsp</result>
        </action>
    </package>

</struts>

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
         version="3.1">

    <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>

    <filter>
        <filter-name>struts2</filter-name>
        <filter-class>org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>struts2</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
</web-app>

index.jsp

<%@ taglib prefix="s" uri="/struts-tags" %>
<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2018/4/5
  Time: 16:33
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
  <head>
    <title>商品管理系统</title>
  </head>
  <body>
  <h1>商品管理系统</h1>
  <table border="1" width="100%">
    <tr>
      <th colspan="9">
        <form action="goodsgetByTerm" method="post">
          商品名:<input type="text" name="goods.gname" />
          生产日期:<input type="date" name="firstTime"/>-<input type="date" name="lastTime" />
          <input type="submit" value="查询" />
        </form>
      </th>
    </tr>
    <tr>
        <th>全选<input type="checkbox" onclick="" name="checkAll" /></th>
        <th>编号</th>
        <th>物资名称</th>
        <th>类型</th>
        <th>数量(件)</th>
        <th>生产商</th>
        <th>生产日期</th>
        <th>入库日期</th>
        <th>操作</th>
    </tr>
    <s:iterator value="#goods" var="g">
        <tr>
            <td><input type="checkbox" name="check" value="<s:property value="#g.Gno"/>" /></td>
            <td><s:property value="#g.Gno"/> </td>
            <td><s:property value="#g.gname"/> </td>
            <td><s:property value="#g.gtype"/> </td>
            <td><s:property value="#g.Gnumber"/> </td>
            <td><s:property value="#g.Gcompany"/> </td>
            <td><s:property value="#g.Gcreatetime"/> </td>
            <td><s:property value="#g.Uintime"/> </td>
            <td><a href="goodsedit?goods.Gno=<s:property value="#g.Gno" />">修改</a> | <a href="goodsdelete?goods.Gno=<s:property value="#g.Gno" />">删除</a></td>
        </tr>
    </s:iterator>
    <tr>
         <th colspan="9">
             <input type="button" id="deleteAll" value="批量删除" />
         </th>
    </tr>
  </table>
  <a href="add.jsp">增加商品</a>

  <script type="text/javascript" src="jquery-1.12.4.js"></script>
  <script>
      $(function(){
          //全选、反选
          $(‘input[name="checkAll"]‘).click(function(){
              if($(this).is(‘:checked‘)){
                  $(‘input[name="check"]‘).each(function () {
                      $(this).prop("checked",true);
                  });
              } else {
                  $(‘input[name="check"]‘).each(function () {
                      $(this).prop("checked",false);
                  });
              }
          });

          //批量删除
          $("#deleteAll").click(function(){
              var Gnos = new Array();
              $("input[name=‘check‘]:checked").each(function() {
                  Gnos.push($(this).val());
              });
              if(Gnos.length==0){
                  alert("没有选中");
                  return;
              }
              $.ajax({
                  url:‘/goodsdeleteAll‘,
                  type:‘post‘,
                  data:{‘Gnos‘:Gnos.toString()},
                  success:function (data) {
                      window.location.reload();
                  }
              });
          });

      });

  </script>
  </body>
</html>

add.jsp

<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2018/4/6
  Time: 15:11
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>增加商品</title>
</head>
<body>
    <h1>添加商品</h1>
    <form action="goodsadd" method="post">
        <p>
            <label>名称:</label>
            <input type="text" name="goods.gname" />
        </p>
        <p>
            <label>类型:</label>
            <input type="text" name="goods.gtype" />
        </p>
        <p>
            <label>数量:</label>
            <input type="number" name="goods.Gnumber" />
        </p>
        <p>
            <label>生产商:</label>
            <input type="text" name="goods.Gcompany" />
        </p>
        <p>
            <input type="submit" value="提交" />
        </p>
    </form>
</body>
</html>

edit.jsp

<%@ taglib prefix="s" uri="/struts-tags" %>
<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2018/4/6
  Time: 15:11
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>修改商品</title>
</head>
<body>
    <h1>修改商品</h1>
    <form action="goodsupdate" method="post">
        <p>
            <label>名称:</label>
            <input type="text" value="<s:property value="#goods1.gname"/>" name="goods.gname" />
        </p>
        <p>
            <label>类型:</label>
            <input type="text" value="<s:property value="#goods1.gtype"/>" name="goods.gtype" />
        </p>
        <p>
            <label>数量:</label>
            <input type="text" value="<s:property value="#goods1.Gnumber"/>" name="goods.Gnumber" />
        </p>
        <p>
            <label>生产商:</label>
            <input type="text" value="<s:property value="#goods1.Gcompany"/>" name="goods.Gcompany" />
        </p>
        <p>
            <label>生产日期:</label>
            <input type="date" value="<s:property value="#goods1.Gcreatetime"/>" name="goods.Gcreatetime" />
        </p>
        <p>
            <input type="hidden" value="<s:property value="#goods1.Gno"/>" name="goods.Gno" />
            <input type="hidden" value="<s:property value="#goods1.uintime"/>" name="goods.uintime" />
            <input type="submit" value="提交" />
        </p>
    </form>
</body>
</html>

效果图:

git地址:https://git.coding.net/h951995489/Goods_SSH_Oracle.git

The end!

原文地址:https://www.cnblogs.com/huasonglin/p/8733225.html

时间: 2024-11-06 03:41:13

SSH+Oracle的整合(SSH与Oracle整合坑巨多)的相关文章

【j2ee spring】8、整合SSH框架(1)

整合SSH框架(1) Spring4+hibernate4+Struts2的整合,整合完成后我会把这个项目上传上去,但是我的建议是最好还是自己在自己的电脑上自己整合一下,我不保证一定没问题 1.首先建立一个web项目 然后我们建立一个spring的配置xml文件 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schem

Struts2,Spring3,Hibernate4整合--SSH框架

Struts2,Spring3,Hibernate4整合--SSH框架(学习中) 一.包的导入 1.Spring包 2.Hibernate 包 3.struts 包 4.数据库方面的包及junt4的包 二.配置文件 1.beans.xml (具体要注意的已经注释到 xml 中了,目前整合了Spring 与 hibernate4 ) <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="h

Spring 4 : 整合 SSH

简介:ssh的整合 1       SSH整合 1.1   jar整合 struts:2.3.15.3 hibernate : 3.6.10 spring: 3.2.0 1.1.1   struts(jar包导入) struts-2.3.15.3\apps\struts2-blank\WEB-INF\lib 模板技术  ,一般用于页面静态化 freemarker:扩展名:*.ftl velocity :扩展名  *.vm 1.1.2   spring(jar包导入) l  基础:4+1 , be

整合SSH遇到的错误

错误一: org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [spring.xml]; nested exception is java.lang.NoClassDefFoundError: org/aopalliance/intercept/MethodInterceptor 解决办法

Myeclipse 6.5 整合SSH(一)

Myeclipse 6.5 整合SSH(一) 最近小学期正在学习基于Myeclipse 的SSH整合,期间出现了各种各样的问题.问题太多,后面会整理后陆续另开博文写.因为发现老师教我们的过程与网上的有所不同,所以这里主要介绍MyEclipse的初始设置过程. 实验环境 MyEclipse 6.5 Tomcat 6.0 绿色版 Navicat Premium mysql-5.1.49-win32 环境安装的配置过程略. 1. 新建工程 打开MyEclipse,单击File –>New –> We

nginx整合php+lua+oracle环境搭建

nginx整合php+lua+oracle环境搭建 标签: nginxluaoraclephplinux 2014-09-25 10:39 1473人阅读 评论(0) 收藏 举报 分类: 技术(70) 版权声明:本文为博主原创文章,未经博主允许不得转载. *执行 yum update 为了得到一个最新的系统 *执行 rpm -ivh oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpm oracle-instantclient12.1-de

.net到Java那些事儿--整合SSH

一.介绍       整体介绍分成两个部分,第一.net转到Java的原因,第二开发SSH时候的环境介绍:       .net到Java的原因: .net开发也将近快3年的样子,加上现在的老东家换过的公司也有4家了,中间的心酸故事我也不想说,我就说下中间遇到一些事和我想做的一些事,这些可能促使我进行了转行,当然中间也犹犹豫豫过,比如Core的到来.还有Xamarin这些东西的涌入使我坚持将近一年的样子,但是在6月份的时候我还是下定决心,先后购入Java核心卷.Spring实战.JVM虚拟机.J

使用MyEclipse整合ssh(Struts、Spring、Hibernate)三大框架(环境搭载+实例源码下载)

前言 SSH不是一个框架,而是多个框架(struts+spring+hibernate)的集成,是目前较流行的一种Web应用程序开源集成框架,用于构建灵活.易于扩展的多层Web应用程序. 集成SSH框架的系统从职责上分为四层:表示层.业务逻辑层.数据持久层和域模块层(实体层). Struts作为系统的整体基础架构,负责MVC的分离,在Struts框架的模型部分,控制业务跳转,利用Hibernate框架对持久层提供支持.Spring一方面作为一个轻量级的IoC容器,负责查找.定位.创建和管理对象及

【j2ee spring】12、整合SSH框架(终结版)

[j2ee spring]12.整合SSH框架(终结版) 最后,我们把整个项目的截图,代码发一下,大家不想下载那个项目的话,可以在这里看到所有的代码(因为那个项目需要一个下载积分,真不多= =,我觉得我搞了那么久,收点积分应该不过分吧...嘿嘿) 这里,我尽量用截图来搞,免得复制粘贴,怪烦的 一.项目整体截图 二.开始全部代码 Person.java Person.hbm.xml PersonService.java package cn.cutter_point.service; import

【j2ee spring】10、整合SSH框架(3)

整合SSH框架(3) Spring4+hibernate4+Struts2的整合,整合完成后我会把这个项目上传上去,但是我的建议是最好还是自己在自己的电脑上自己整合一下,我不保证一定没问题 前面那个,我们已经基本整合了SSH框架,但是还是有一些小小的瑕疵, 比如:PersonAction.java里面的 //获取实例,方法1 ServletContext sc = ServletActionContext.getRequest().getSession().getServletContext()