项目实战---国税协同办公平台---day01

SSH框架搭建及整合

1、 新建数据库及web项目

**1.1 创建数据库**
CREATE DATABASE itcastTax DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;

2、新建web项目

2.1 新建工作空间指定项目编码(或工作空间编码)为utf-8,再建 web project,

这里写图片描述

2.2 配置buildpath

这里写图片描述

2.3 引入tomcat 的包:

这里写图片描述

这里写图片描述

2.4 添加jstl jar包和mysql驱动包;

这里写图片描述

2.5 添加struts2的jar包和配置文件

添加jar包:

commons-fileupload-1.3.1.jar,commons-io-2.2.jar,commons-lang-2.4.jar ,commons-lang3-3.2.jar,freemarker-2.3.19.jar,ognl-3.0.6.jar,struts2-core-2.x.jar
,struts2-spring-plugin-2.x.jar,xwork-core-2.x.jar 到web-inf/lib目录下。

添加struts.xml到src目录下。可在“struts-2.x\apps\struts2-blank\WEB-INF\classes”下复制。

在struts.xml中添加几个常用属性:

<!-- 禁用动态方法访问 -->
    <constant name="struts.enable.DynamicMethodInvocation" value="false" />
    <!-- 配置成开发模式 -->
    <constant name="struts.devMode" value="true" />
    <!-- 配置拓展名为action -->
    <constant name="struts.action.extention" value="action" />
    <!-- 把主题配置成simple -->
    <constant name="struts.ui.theme" value="simple" />

配置web.xml:添加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>*.action</url-pattern>
    </filter-mapping>

3、添加hibernate的jar包和配置文件

3.1 添加hibernate jar包:

hibernate3.jar,lib/required/*.jar,lib\jpa\hibernate-jpa-2.0-api-1.0.0.Final.jar,lib\bytecode\cglib\cglib-2.2.jar到web-inf/lib目录下。

4、添加spring的jar包和配置文件

4.1添加spring3.0.2中的jar包

这里写图片描述

添加spring配置文件applicationContext.xml 到src目录下;

  <!-- 引入外部sprign配置文件 -->
    <import resource="classpath:cn/itcast/*/conf/*-spring.xml"/>

在web.xml中注册spring监听器,启动spring容器:

<listener>
       <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
    <context-p
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值