ssh框架中.xml文件小技巧分离xml
struts.xml文件
struts.xml文件里的action可以分离出来,如:
<!-- 预警信息监测 -->
<include file="config/struts/warningInformAtion-struts.xml"></include>
注: include是放在</struts>标签的前面
在src下面新建 package 名为:config.struts,再新建xml文件为warningInformAtion-struts.xml,这样,我们就可以把预警信息监测的action全放在warningInformAtion-struts.xml里面了
warningInformAtion-struts.xml的内容如下:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd"> <!-- 预警信息监测 -->
<struts>
<package name="warningInformation" extends="struts-default"> <!-- 显示主界面 -->
<action name="gotoWarningInformationSetting" class="warningInformationAction" method="gotoWarningInformationSetting">
<result name="success">/next/warningInformation.jsp</result>
</action> </package>
</struts>
applicationContext.xml文件
applicationContext.xml的bean可以分离出来,如:
<!-- 预警信息监测 -->
<import resource="classpath:config/bean/warningInformation-bean.xml"/>
注:import是放在</bean>标签前面的
在src下面新建 package 名为:config.bean,再新建xml文件为warningInformation-bean.xml,这样,我们就可以把预警信息监测的bean全放在warningInformation-bean.xml里面了
warningInformation-bean.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:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"> <!-- 节能预警监测 -->
<bean name="warningInformationAction" class="com.java.ssh.action.WarningInformationAction">
<property name="warningInformationManager">
<ref bean="warningInformationManager"/>
</property>
</bean>
</beans>
ssh框架中.xml文件小技巧分离xml的更多相关文章
- SSH框架中配置log4j的方法
SSH框架中使用log4j的方便之处 1. 动态的改变记录级别和策略,即修改log4j.properties,不需要重启Web应用,这需要在web.xml中设置一下.2. 把log文件定在 /WEB- ...
- ACM 做题过程中的一些小技巧。
ACM做题过程中的一些小技巧. 1.一般用C语言节约空间,要用C++库函数或STL时才用C++; cout.cin和printf.scanf最好不要混用. 2.有时候int型不够用,可以用long l ...
- 在SSH框架中使用Spring的好处(转)
以下是我总结下今天笔试中SSh中的总结: 在SSH框架中spring充当了管理容器的角色.我们都知道Hibernate用来做持久层,因为它将JDBC做了一个良好的封装,程序员在与数据库进行交互时可以不 ...
- C语言中的调试小技巧
C语言中的调试小技巧 经常看到有人介绍一些IDE或者像gdb这样的调试器的很高级的调试功能,也听人说过有些牛人做工程的时候就用printf来调试,不用特殊的调试器.特别是在代码经过编译器一些比较复杂的 ...
- C#中使用swagger小技巧
C#中使用swagger小技巧 swaggerUI显示的接口内容主要用于开发阶段便于与前端联调,不适合发布到对外的站点. 有以下两种方式,让接口不显示在SwaggerUI中 1.使用属性 [ApiEx ...
- jquery获取json对象中的key小技巧
jquery获取json对象中的key小技巧 比如有一个json var json = {"name" : "Tom", "age" : 1 ...
- 在SSH框架中,如何得到POST请求的URL和参数列表
在做项目的API通知接口的时候,发现在SSH框架中无法获取到对方服务器发来的异步通知信息.最后排查到的原因可能是struts2对HttpServletRequest进行了二次处理,那么该如何拿到pos ...
- SSH框架中hibernate 出现 user is not mapped 问题
SSH框架中hibernate 出现 user is not mapped 问题 在做SSH框架整合时,在进行DAO操作时.这里就只调用了chekUser()方法.运行时报 user is ...
- ES6中常用的小技巧,用了事半功倍哦
ES6中常用的小技巧,如果能在实际项目中能使用到,必定事半功倍: 1. 强制要求参数 ES6提供了默认参数值机制,允许你为参数设置默认值,防止在函数被调用时没有传入这些参数. 在下面的例子中,我们写了 ...
随机推荐
- python之通过thread来实现多进程
代码如下: import threading, time class Test1(threading.Thread): def __init__(self, name): super().__init ...
- python用unittest+HTMLTestRunner的框架测试并生成测试报告
直接贴代码: import unittestfrom selenium import webdriverfrom time import sleepimport osimport time # 定义打 ...
- LeetCode(69):x 的平方根
Easy! 题目描述: 实现 int sqrt(int x) 函数. 计算并返回 x 的平方根,其中 x 是非负整数. 由于返回类型是整数,结果只保留整数的部分,小数部分将被舍去. 示例 1: 输入: ...
- spring data jpa 全面解析(实践 + 源码分析)
前言 本文将从示例.原理.应用3个方面介绍spring data jpa. 以下分析基于spring boot 2.0 + spring 5.0.4版本源码 概述 JPA是什么? JPA (Java ...
- C++ LocalAlloc() & LocalSize() & LocalFree ()
关于LocalAlloc function,参考:https://msdn.microsoft.com/en-us/library/windows/desktop/aa366723(v=vs.85). ...
- springboot+mybatis+springMVC基础框架搭建
项目结构概览 pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http: ...
- Red Language
官网地址:http://www.red-lang.org/ 源代码地址:https://github.com/red/red 通过github上的Readme,可以完成Hello World的学习 ...
- Atom插件下载失败解决办法
转自:http://www.cnblogs.com/20145221GQ/p/5334762.html#正题 一般方法(Atom自动安装) 打开Atom >> Packages >& ...
- MyBatis - 10.MyBatis扩展
1.PageHelpler分页插件使用 官方文档:中文 1.1 引入插件 1.1.1 引入的jar pagehelper-5.1.6.jar jsqlparser-1.2.jar 1.1.2 mave ...
- 一脸懵逼学习Linux的Shell编程
1:什么是Shell??? (1)Shell是用户与内核进行交互操作的一种接口,目前最流行的Shell称为bash Shell(2)Shell也是一门编程语言<解释型的编程语言>,即she ...