这是一个Struts2.1.8.1应用,代码如下

首先是web.xml文件

view plaincopy to clipboardprint?
01.<?xml version="1.0" encoding="UTF-8"?>  
02.<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"  
03.    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
04.    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee    
05.    http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">  
06.    <filter>  
07.        <filter-name>struts2</filter-name>  
08.        <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>  
09.    </filter>  
10.    <filter-mapping>  
11.        <filter-name>struts2</filter-name>  
12.        <url-pattern>/*</url-pattern>  
13.    </filter-mapping>  
14.    <welcome-file-list>  
15.        <welcome-file>methodFilter.jsp</welcome-file>  
16.    </welcome-file-list>  
17.</web-app>  
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
 http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
 <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>
 <welcome-file-list>
  <welcome-file>methodFilter.jsp</welcome-file>
 </welcome-file-list>
</web-app>

然后用于提交方法过滤测试的methodFilter.jsp页面

view plaincopy to clipboardprint?
01.<%@ page language="java" pageEncoding="UTF-8"%>  
02.<%@ taglib prefix="s" uri="/struts-tags"%>  
03.<s:form action="methodFilter" theme="simple">  
04.    您可以直接点击Submit提交请求,然后在控制台查看输出情况<br/>  
05.    <s:submit value="我要测试方法过滤拦截器"/>  
06.</s:form>  
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<s:form action="methodFilter" theme="simple">
 您可以直接点击Submit提交请求,然后在控制台查看输出情况<br/>
 <s:submit value="我要测试方法过滤拦截器"/>
</s:form>

然后是用于显示方法过滤结果的methodFilterResult.jsp页面

view plaincopy to clipboardprint?
01.<%@ page pageEncoding="UTF-8"%>  
02.<h2>请移步控制台查看输出情况</h2>  
<%@ page pageEncoding="UTF-8"%>
<h2>请移步控制台查看输出情况</h2>

然后是struts.xml文件

view plaincopy to clipboardprint?

01.<?xml version="1.0" encoding="UTF-8" ?>
02.<!DOCTYPE struts PUBLIC
03. "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN"
04. "http://struts.apache.org/dtds/struts-2.1.dtd">
05.<struts>
06. <package name="methodFilter" extends="struts-default">
07. <interceptors>
08. <interceptor name="myInterceptor11" class="com.jadyer.interceptor.MyInterceptor11">
09. <param name="hello">world</param>
10. </interceptor>
11. <!-- <param name="hello">world</param>表示为拦截器增加一个名为hello值为world的属性 -->
12. <!-- 但是这里也只是为hello赋了初值为world。如若在下面的<action/>中配置使用该拦截器的时候 -->
13. <!-- 增加了<param name="hello">welcome</param>,则最后拦截器类中hello属性值即为welcome -->
14. <interceptor name="myInterceptor22" class="com.jadyer.interceptor.MyInterceptor22"/>
15. <interceptor name="myInterceptor33" class="com.jadyer.interceptor.MyInterceptor33">
16. <param name="includeMethods">test,abc</param>
17. </interceptor>
18. </interceptors>
19. <action name="methodFilter" class="com.jadyer.action.MethodFilterAction" method="test">
20. <result name="success">/methodFilterResult.jsp</result>
21. <interceptor-ref name="defaultStack"/>
22. <interceptor-ref name="myInterceptor11"/>
23. <interceptor-ref name="myInterceptor22"/>
24. <interceptor-ref name="myInterceptor33">
25. <param name="includeMethods">abc</param>
26. </interceptor-ref>
27. </action>
28. </package>
29.</struts>

30.<!-- *********************【方法过滤拦截器的使用】********************************************** -->  
31.<!-- 默认的情况下,拦截器会拦截Action中的所有的方法,这里不包括setter或getter方法 -->  
32.<!-- 这时就可以使用方法过滤拦截器来拦截指定的方法,这是一种更加细化的拦截器的配置方式 -->  
33.<!-- 它可以细化到拦截具体的某个方法。而不是拦截某个Action,因为拦截Action是一种粗粒度的实现方式 -->  
34.<!-- 使用includeMethods指明拦截器所要拦截的方法。使用excludeMethods指明拦截器不再拦截的方法 -->  
35.<!-- 这里excludeMethods和includeMethods是在MethodFilterInterceptor类中定义的成员变量 -->  
36.<!-- 而且只要includeMethods进来的方法就一定会被拦截,而不管是否已经把它excludeMethods在外了 -->  
37.<!-- 也就是说includeMethods的优先级要高于excludeMethods -->  
38.<!-- 也可以使用<param name="includeMethods"/>在上面定义拦截器的时候指定全局性过滤的方法 -->  
39.<!-- 区别就是对方法的过滤有全局性和局部性区分。而当发生冲突时,则依照【就近原则】以局部性的配置为准 -->  
40.<!-- 所谓的发生冲突,指的是类似于全局中有一个includeMethods配置,而局部中也有一个includeMethods配置 -->  
41.<!-- 另外,还有一种情况,假设全局性过滤定义为<param name="includeMethods">test</param> -->  
42.<!-- 而在局部性过滤中定义为<param name="excludeMethods">test</param> -->  
43.<!-- 这种情况下,<param name="includeMethods">test</param>将生效,即拦截Action中的test()方法 -->  
44.<!-- 这个时候全局中配置的是拦截,局部中配置的是不拦截,二者并没有发生冲突,所以仍是以includeMethods优先级高 -->  
45.<!-- 可以认为在局部的配置中,已经隐含的把<param name="includeMethods">test</param>继承过来了 -->  
46.<!-- 补充:这里衡量的所谓拦截到与否,主要可以通过查看控制台输出的语句,以判断是否执行到该拦截器内部 -->  
47.<!-- **************************************************************************************** -->  
<?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="methodFilter" extends="struts-default">
  <interceptors>
   <interceptor name="myInterceptor11" class="com.jadyer.interceptor.MyInterceptor11">
    <param name="hello">world</param>
   </interceptor>
   <!-- <param name="hello">world</param>表示为拦截器增加一个名为hello值为world的属性 -->
   <!-- 但是这里也只是为hello赋了初值为world。如若在下面的<action/>中配置使用该拦截器的时候 -->
   <!-- 增加了<param name="hello">welcome</param>,则最后拦截器类中hello属性值即为welcome -->
   <interceptor name="myInterceptor22" class="com.jadyer.interceptor.MyInterceptor22"/>
   <interceptor name="myInterceptor33" class="com.jadyer.interceptor.MyInterceptor33">
    <param name="includeMethods">test,abc</param>
   </interceptor>
  </interceptors>
  <action name="methodFilter" class="com.jadyer.action.MethodFilterAction" method="test">
   <result name="success">/methodFilterResult.jsp</result>
   <interceptor-ref name="defaultStack"/>
   <interceptor-ref name="myInterceptor11"/>
   <interceptor-ref name="myInterceptor22"/>
   <interceptor-ref name="myInterceptor33">
    <param name="includeMethods">abc</param>
   </interceptor-ref>
  </action>
 </package>
</struts>
<!-- *********************【方法过滤拦截器的使用】********************************************** -->
<!-- 默认的情况下,拦截器会拦截Action中的所有的方法,这里不包括setter或getter方法 -->
<!-- 这时就可以使用方法过滤拦截器来拦截指定的方法,这是一种更加细化的拦截器的配置方式 -->
<!-- 它可以细化到拦截具体的某个方法。而不是拦截某个Action,因为拦截Action是一种粗粒度的实现方式 -->
<!-- 使用includeMethods指明拦截器所要拦截的方法。使用excludeMethods指明拦截器不再拦截的方法 -->
<!-- 这里excludeMethods和includeMethods是在MethodFilterInterceptor类中定义的成员变量 -->
<!-- 而且只要includeMethods进来的方法就一定会被拦截,而不管是否已经把它excludeMethods在外了 -->
<!-- 也就是说includeMethods的优先级要高于excludeMethods -->
<!-- 也可以使用<param name="includeMethods"/>在上面定义拦截器的时候指定全局性过滤的方法 -->
<!-- 区别就是对方法的过滤有全局性和局部性区分。而当发生冲突时,则依照【就近原则】以局部性的配置为准 -->
<!-- 所谓的发生冲突,指的是类似于全局中有一个includeMethods配置,而局部中也有一个includeMethods配置 -->
<!-- 另外,还有一种情况,假设全局性过滤定义为<param name="includeMethods">test</param> -->
<!-- 而在局部性过滤中定义为<param name="excludeMethods">test</param> -->
<!-- 这种情况下,<param name="includeMethods">test</param>将生效,即拦截Action中的test()方法 -->
<!-- 这个时候全局中配置的是拦截,局部中配置的是不拦截,二者并没有发生冲突,所以仍是以includeMethods优先级高 -->
<!-- 可以认为在局部的配置中,已经隐含的把<param name="includeMethods">test</param>继承过来了 -->
<!-- 补充:这里衡量的所谓拦截到与否,主要可以通过查看控制台输出的语句,以判断是否执行到该拦截器内部 -->
<!-- **************************************************************************************** -->

实现了Interceptor接口的自定义拦截器MyInterceptor11.java

view plaincopy to clipboardprint?
01.package com.jadyer.interceptor;   
02.  
03.import com.opensymphony.xwork2.ActionInvocation;   
04.import com.opensymphony.xwork2.interceptor.Interceptor;   
05.  
06./**  
07. * 实现Interceptor接口的自定义拦截器  
08. * @see 【这种方式不太常用】  
09. */  
")   
11.public class MyInterceptor11 implements Interceptor {   
12.    //这里的属性名要与struts.xml配置的<param name=""/>中的name值相同   
13.    //然后Struts2会自动将struts.xml中配置的world值赋值到这里的hello属性中   
14.    //当然,前提是要提供setter和getter方法,只要符合JavaBean的要求即可   
15.    private String hello;   
16.  
17.    public String getHello() {   
18.        return hello;   
19.    }   
20.    public void setHello(String hello) {   
21.        this.hello = hello;   
22.    }   
23.  
24.    /**  
25.     * 初始化时执行的方法  
26.     */  
27.    public void init() {   
28.        System.out.println("------MyInterceptor11 init method invoked------");   
29.        System.out.println(hello);   
30.    }   
31.    /**  
32.     * 销毁时执行的方法  
33.     */  
34.    public void destroy() {   
35.        System.out.println("------MyInterceptor11 destroy method invoked------");   
36.    }   
37.  
38.    //每执行一次action请求,这里的intercept()方法都会被执行一次   
39.    public String intercept(ActionInvocation invocation) throws Exception {   
40.        System.out.println("------MyInterceptor11 invoked begin------");   
41.        //调用invoke()方法   
42.        //如果还有下一个拦截器的话,就执行下一个拦截器   
43.        //如果没有下一个拦截器的话,便执行Action中的方法   
44.        String result = invocation.invoke();   
45.        System.out.println("------MyInterceptor11 invoked finish------");   
46.        return result;   
47.    }   
48.}   
49./********************【浅析Struts2的拦截器】***********************************************************/  
50.//Struts2中的拦截器,实际上就是用来拦截Action的。它就相当于入口和出口一样,把Action的相关方法包裹在中间了   
51.//过滤器可以组成过滤器链,也就是有多个过滤器来过滤相同的东西。拦截器同样也有拦截器链,在Struts2中称为拦截器栈   
52.//拦截器栈相当于一串拦截器,用来共同的拦截某一个Action。拦截的顺序是按照配置的顺序执行的   
53.//假设先配置的是myInterceptor11,后配置的是myInterceptor22   
54.//所以在执行时,先执行myInterceptor11,后执行myInterceptor22   
55.//但是在结束时,先执行myInterceptor22,后执行myInterceptor11   
56.//就好像进入一个有两道门的房间一样,进去的顺序和出来的顺序正好相反   
57.//也就是说它首先会进入第一个拦截器,出来后再进入第二个拦截器,依此类推,最后进入Action的execute()方法   
58.//当execute()执行后,再按照相反的顺序,先回到第二个拦截器,再回到第一个拦截器,最后才回到结果视图   
59.//因此invoke()就是用来判断,若还有下一个拦截器,就调用下一个拦截器。否则,直接跳到Action的execute()方法   
60./********************【Struts2的默认拦截器】***********************************************************/  
61.//实际上可以把Struts2看成是一个空的容器。就是因为里面配置了大量的拦截器,导致了我们的请求需要一层一层的通过这些拦截器   
62.//然后它会处理我们的请求,并根据我们的配置,把它所感兴趣的东西解析出来。如果出现问题,它会放到错误消息里面去   
63./****************************************************************************************************/

package com.jadyer.interceptor;

import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.Interceptor; /**
* 实现Interceptor接口的自定义拦截器
* @see 【这种方式不太常用】
*/
@SuppressWarnings("serial")
public class MyInterceptor11 implements Interceptor {
//这里的属性名要与struts.xml配置的<param name=""/>中的name值相同
//然后Struts2会自动将struts.xml中配置的world值赋值到这里的hello属性中
//当然,前提是要提供setter和getter方法,只要符合JavaBean的要求即可
private String hello; public String getHello() {
return hello;
}
public void setHello(String hello) {
this.hello = hello;
} /**
* 初始化时执行的方法
*/
public void init() {
System.out.println("------MyInterceptor11 init method invoked------");
System.out.println(hello);
}
/**
* 销毁时执行的方法
*/
public void destroy() {
System.out.println("------MyInterceptor11 destroy method invoked------");
} //每执行一次action请求,这里的intercept()方法都会被执行一次
public String intercept(ActionInvocation invocation) throws Exception {
System.out.println("------MyInterceptor11 invoked begin------");
//调用invoke()方法
//如果还有下一个拦截器的话,就执行下一个拦截器
//如果没有下一个拦截器的话,便执行Action中的方法
String result = invocation.invoke();
System.out.println("------MyInterceptor11 invoked finish------");
return result;
}
}

/********************【浅析Struts2的拦截器】***********************************************************/
//Struts2中的拦截器,实际上就是用来拦截Action的。它就相当于入口和出口一样,把Action的相关方法包裹在中间了
//过滤器可以组成过滤器链,也就是有多个过滤器来过滤相同的东西。拦截器同样也有拦截器链,在Struts2中称为拦截器栈
//拦截器栈相当于一串拦截器,用来共同的拦截某一个Action。拦截的顺序是按照配置的顺序执行的
//假设先配置的是myInterceptor11,后配置的是myInterceptor22
//所以在执行时,先执行myInterceptor11,后执行myInterceptor22
//但是在结束时,先执行myInterceptor22,后执行myInterceptor11
//就好像进入一个有两道门的房间一样,进去的顺序和出来的顺序正好相反
//也就是说它首先会进入第一个拦截器,出来后再进入第二个拦截器,依此类推,最后进入Action的execute()方法
//当execute()执行后,再按照相反的顺序,先回到第二个拦截器,再回到第一个拦截器,最后才回到结果视图
//因此invoke()就是用来判断,若还有下一个拦截器,就调用下一个拦截器。否则,直接跳到Action的execute()方法
/********************【Struts2的默认拦截器】***********************************************************/
//实际上可以把Struts2看成是一个空的容器。就是因为里面配置了大量的拦截器,导致了我们的请求需要一层一层的通过这些拦截器
//然后它会处理我们的请求,并根据我们的配置,把它所感兴趣的东西解析出来。如果出现问题,它会放到错误消息里面去
/****************************************************************************************************/

继承了AbstractInterceptor类的自定义拦截器MyInterceptor22.java

view plaincopy to clipboardprint?

package com.jadyer.interceptor;   

import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor; /**
* 继承AbstractInterceptor类的自定义拦截器
* @see 【这种方式比较常用】
* @see 继承AbstractInterceptor之后,就不需要再去实现init()和destroy()方法了
* @see 所以实际应用中,更多的时候还是继承AbstractInterceptor,而不是实现Interceptor
*/
")
public class MyInterceptor22 extends AbstractInterceptor {
@Override
public String intercept(ActionInvocation invocation) throws Exception {
System.out.println("------MyInterceptor22 invoked begin------");
String result = invocation.invoke();
System.out.println("------MyInterceptor22 invoked finish------");
return result;
}
}
package com.jadyer.interceptor;

import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor; /**
* 继承AbstractInterceptor类的自定义拦截器
* @see 【这种方式比较常用】
* @see 继承AbstractInterceptor之后,就不需要再去实现init()和destroy()方法了
* @see 所以实际应用中,更多的时候还是继承AbstractInterceptor,而不是实现Interceptor
*/
@SuppressWarnings("serial")
public class MyInterceptor22 extends AbstractInterceptor {
@Override
public String intercept(ActionInvocation invocation) throws Exception {
System.out.println("------MyInterceptor22 invoked begin------");
String result = invocation.invoke();
System.out.println("------MyInterceptor22 invoked finish------");
return result;
}
}

继承了MethodFilterInterceptor拦截器类的自定义拦截器MyInterceptor33.java

view plaincopy to clipboardprint?
01.package com.jadyer.interceptor;   
02.  
03.import com.opensymphony.xwork2.ActionInvocation;   
04.import com.opensymphony.xwork2.interceptor.MethodFilterInterceptor;   
05.  
06./**  
07. * 继承MethodFilterInterceptor的拦截器,即方法过滤的拦截器  
08. * @see 查看MethodFilterInterceptor的源码可知,它也是一个拦截器类,它继承了AbstractInterceptor  
09. * @see 观察它的类名,可以发现,它就是一个拦截某一个具体的方法的方法过滤拦截器  
10. * @see 而MethodFilterInterceptor类已经自动实现好了Intercept()方法  
11. * @see 实际上MethodFilterInterceptor类中的Intercept()方法真正执行的是它本身的一个doIntercept()抽象方法  
12. * @see 因此,我们想要拦截某一个方法的时候,只要继承MethodFilterInterceptor类,然后实现doIntercept()便OK  
13. */  
")   
15.public class MyInterceptor33 extends MethodFilterInterceptor {   
16.    @Override  
17.    protected String doIntercept(ActionInvocation invocation) throws Exception {   
18.        System.out.println("------MyInterceptor33 invoked begin------");   
19.        String result = invocation.invoke();   
20.        System.out.println("------MyInterceptor33 invoked finish------");   
21.        return result;   
22.    }   
23.}  
package com.jadyer.interceptor;

import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.MethodFilterInterceptor;

/**
 * 继承MethodFilterInterceptor的拦截器,即方法过滤的拦截器
 * @see 查看MethodFilterInterceptor的源码可知,它也是一个拦截器类,它继承了AbstractInterceptor
 * @see 观察它的类名,可以发现,它就是一个拦截某一个具体的方法的方法过滤拦截器
 * @see 而MethodFilterInterceptor类已经自动实现好了Intercept()方法
 * @see 实际上MethodFilterInterceptor类中的Intercept()方法真正执行的是它本身的一个doIntercept()抽象方法
 * @see 因此,我们想要拦截某一个方法的时候,只要继承MethodFilterInterceptor类,然后实现doIntercept()便OK
 */
@SuppressWarnings("serial")
public class MyInterceptor33 extends MethodFilterInterceptor {
 @Override
 protected String doIntercept(ActionInvocation invocation) throws Exception {
  System.out.println("------MyInterceptor33 invoked begin------");
  String result = invocation.invoke();
  System.out.println("------MyInterceptor33 invoked finish------");
  return result;
 }
}

最后是用到的Action类

view plaincopy to clipboardprint?
01.package com.jadyer.action;   
02.  
03.import com.opensymphony.xwork2.ActionSupport;   
04.  
")   
06.public class MethodFilterAction extends ActionSupport{   
07.    public String test() throws Exception {   
08.        System.out.println("------test() is invoked------");   
09.        return SUCCESS;   
10.    }   
11.       
12.    public String abc() throws Exception {   
13.        System.out.println("------abc() is invoked------");   
14.        return SUCCESS;   
15.    }   
16.  
17.    @Override  
18.    public String execute() throws Exception {   
19.        System.out.println("------execute() is invoked------");   
20.        return SUCCESS;   
21.    }   
22.}

【转】Struts2中的MethodFilterInterceptor(转)的更多相关文章

  1. 十五、struts2中的拦截器(框架功能核心)

    十五.struts2中的拦截器(框架功能核心) 1.过滤器VS拦截器 功能是一回事. 过滤器是Servlet规范中的技术,可以对请求和响应进行过滤. 拦截器是Struts2框架中的技术,实现AOP(面 ...

  2. struts2中的拦截器

    一  AOP思想: 面向切面编程的思想 AOP为Aspect Oriented Programming的缩写,意为:面向切面编程,通过预编译方式和运行期动态代理实现程序功能的统一维护的一种技术.AOP ...

  3. struts2中从后台读取数据到<s:select>

    看到网上好多有struts2中从后台读取数据到<s:select>的,但都 不太详细,可能是我自己理解不了吧!所以我自己做了 一个,其中可能 有很多不好的地方,望广大网友指出 结果如图 p ...

  4. struts2中各个jar包作用

    Struts2.3.4 所需的Jar包及介绍 Jar包的分类 jar包名称 jar包版本 jar包 文件名 jar包 的作用 jar包内包含的主要包路径及主要类 依赖的自有jar包名称 依赖的第三方j ...

  5. Struts2中Date日期转换的问题

      今天跑程序的时候莫名其妙的出现了下面的一个异常: java.lang.NoSuchMethodException:com.ca.agent.model.mybatis.ApprovalInforC ...

  6. struts2中的jar包

    核心包: (后面数字是版本号,不同struts2版本,数字可能不一样.) struts2-core-2.1.8.1 struts2的核心jar包,不可缺少的 xwork-core-2.1.6 xwor ...

  7. Struts2中的EasyUI

    Struts2中的EasyUI 一.easy UI是类似于jQuery UI的插件库,它提供了丰富的各种常用插件:tree.datagrid... tree插件: 语法:$(selector).tre ...

  8. struts2中的jsp值传到后台action接收的三种方法

    struts2中的Action接收表单传递过来的参数有3种方法: 如,登陆表单login.jsp: <form action="login" method="pos ...

  9. Struts2中动态方法的调用

    Struts2中动态方法调用就是为了解决一个action对应多个请求的处理,以免action太多. 主要有一下三种方法:指定method属性.感叹号方式和通配符方式.推荐使用第三种方式. 1.指定me ...

随机推荐

  1. C# GUID的使用

    GUID(全局统一标识符)是指在一台机器上生成的数字,它保证对在同一时空中的所有机器都是唯一的.通常平台会提供生成GUID的API.生成算法很有意思,用到了以太网卡地址.纳秒级时间.芯片ID码和许多可 ...

  2. 将Android Studio工程导入到Eclipse中

    1.前言 studio项目中src/main/java目录里面的代码对应的是eclispe项目中的src目录中的代码. 而studio中src目录里面包括整个项目的所有代码包括资源文件和xml. 2. ...

  3. 《OD学HBase》20160820

    一.案例 微博: 微博内容: 关注用户和粉丝用户: 添加或移除关注用户 查看关注用户的微博内容 微博数据存储: 响应时间 秒级 无延迟 (1)mysql分布式 (2)hbase数据库 使用HBase数 ...

  4. oracle数据导入的常用命令

    oracle 中数据库完全导入导出:cmd命令行模式 oracle数据库cmdfile数据库服务器constraints Oracle数据导入导出imp/exp就相当于oracle数据还原与备份.ex ...

  5. ubuntu搭建DNS

    ubuntu搭建DNS 一.     bind简介: BIND是Domain Name System (DNS) 协议的一个实现,提供了DNS主要功能的开放实现,主要包括以下三种: *域名服务器 *D ...

  6. ajax连接数据库并操作数据库

    Response.Write("<script  type='text/javascript' language='javascript' >alert('用户名不能为空!请输入 ...

  7. 07day2

    居然是动规专场.这样不好吧?   采药 [问题描述] 辰辰是个天资聪颖的孩子,他的梦想是成为世界上最伟大的医师.为此,他想拜附近最有威望的医师为师.医师为了判断他的资质,给他出了一个难题.医师把他带到 ...

  8. 查看Linux下端口占用情况的命令

    在使用Linux系统的过程中,有时候会遇到端口被占用而导致服务无法启动的情况.比如HTTP使用80端口,但当启动Apache时,却发现此端口正在使用. 这种情况大多数是由于软件冲突.或者默认端口设置不 ...

  9. Linux下ll命令与ls -l

    还大三Linux课的债. 1.ll命令用于显示当前文件下非隐藏文件的详情 查询结果分为7栏: 1)如' -rw-r--r--' 表示三种用户对该文件的不同权限: r:可读:w:可写:x:可执行 其中第 ...

  10. Android Studio你不知道的调试技巧

    写代码不可避免有Bug,通常情况下除了日志最直接的调试手段就是debug:那么你的调试技术停留在哪一阶段呢?仅仅是下个断点单步执行吗?或者你知道 Evaluate Expression, 知道条件断点 ...