spring_day4_03-ssh整合(struts2整合spring)
来源:互联网 发布:网络统考报名修改密码 编辑:程序博客网 时间:2024/06/09 21:16
项目结构:
/spring_day04_sshdemo1/WebContent/WEB-INF/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_2_5.xsd" id="WebApp_ID" version="2.5"> <display-name>spring_day04_sshdemo1</display-name> <context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:spring3.xml</param-value> </context-param> <!-- 过滤器 start --> <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> <!-- 过滤器 end --> <!-- 监听器 --> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <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>
/spring_day04_sshdemo1/src/struts.xml
<?xml version="1.0" encoding="UTF-8"?><!-- struts2约束 start --><!DOCTYPE struts PUBLIC"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN""http://struts.apache.org/dtds/struts-2.3.dtd"><!-- struts2约束 end --><struts><package name="demo1" extends="struts-default" namespace="/"><!-- class属性里面不写action全路径,因为写,action对象就创建两次写spring配置的action的bean的id值 --><action name="userAction" class="userAction"></action></package></struts>
/spring_day04_sshdemo1/src/spring3.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: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.xsdhttp://www.springframework.org/schema/contexthttp://www.springframework.org/schema/context/spring-context.xsdhttp://www.springframework.org/schema/aophttp://www.springframework.org/schema/aop/spring-aop.xsdhttp://www.springframework.org/schema/txhttp://www.springframework.org/schema/tx/spring-tx.xsd"><!-- 配置c3p0连接池 --><bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"><property name="driverClass" value="com.mysql.jdbc.Driver"></property><!-- & 需要转义成 & --><property name="jdbcUrl" value="jdbc:mysql://*.36.138:3306/spring_day04?userUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull" /><property name="user" value="root"></property><property name="password" value="*"></property></bean><!-- 配置action对象 --><bean id="userAction" class="com.hlg.action.UserAction" scope="prototype"></bean></beans>
com.hlg.action.UserAction
package com.hlg.action;import com.opensymphony.xwork2.ActionSupport;public class UserAction extends ActionSupport {public String execute(){System.out.println("struts2整合spring成功....");return NONE;}}
访问:http://localhost:8080/spring_day04_sshdemo1/userAction.action
阅读全文
0 0
- spring_day4_03-ssh整合(struts2整合spring)
- SSH整合(三)- Spring整合Struts2
- Spring整合Hibernate和Struts2 (SSH)
- SSH整合(Spring+Struts2+Hibernate)
- ssh整合(1)struts2和spring整合
- ssh 整合 (spring + Struts2 + hibernate)
- ssh(Spring struts2 hibernate)整合
- SSH—Struts2整合Spring
- SSH整合:Struts2+Spring+Hibernate
- 【SSH】Hibernate+Struts2+Spring整合
- spring+struts2+hibernate整合(ssh)
- SSH框架整合(Spring整合Struts2,和Spring整合Hibernate)
- ssh-ssh整合(Struts2+Spring+Hibernate)
- SSH的整合,Spring与Hibernate整合,与Struts2整合,ssh整合
- struts2+spring+hibernate实现ARDU功能(ssh整合)
- ssh 框架整合试例 (spring+struts2+hibernate)
- SSH三大框架整合(Hibernate,Spring,struts2)
- 【SSH (六)】struts2 整合 spring 并 连接数据库
- TypeScript入门
- 准备Python3
- 怎么用pulltorefresh
- 11周 项目2
- Linux——CentOS7添加/删除用户和用户组
- spring_day4_03-ssh整合(struts2整合spring)
- VS2010设置目标文件(.dll/.exe)和导入库文件(.lib)的输出路径
- 使用zabbix api获取最近告警数据
- FreeRTOS 内存配置引起的一些问题
- ScrollView和HorizontalScrollView的使用
- qisan__lianxi2查询排序全选删除批量删除
- CNN中,1X1卷积核到底有什么作用呢?
- ubuntu14.04下安装opencv3.0(alpha版本)
- 商品库存清单案例(Java)