candy 发表于 2015-11-18 11:44:08

spring 3.1.0.M 注解MVC + filter + AOP + memcache + C3P0

  spring 3.1的包全导了 + 依赖包 commons-logging-1.1.1.jar+servlet-api.jar


  AOP需要的几个包 aopalliance.jar+aspectjrt.jar+aspectjweaver.jar+cglib-nodep-2.1_3.jar
  memcache 需要的包   java_memcached-release_2.6.1.jar   +依赖包   slf4j-api-1.6.1.jar+slf4j-simple-1.6.1.jar   +   commons-pool-1.5.6.jar


  C3P0 需要的包 c3p0-0.9.1.2.jar   数据库包mysql-connector-java-5.1.12-bin.jar
  


  WEB.xml
  


view plaincopyprint?

[*]<?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?>
[*]<web-app xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xmlns=&quot;http://java.sun.com/xml/ns/javaee&quot; xmlns:web=&quot;http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd&quot; xsi:schemaLocation=&quot;http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd&quot; id=&quot;WebApp_ID&quot; version=&quot;3.0&quot;>
[*]<display-name>springDemo</display-name>
[*]<welcome-file-list>
[*]    <welcome-file>index.do</welcome-file>
[*]</welcome-file-list>
[*]<listener>
[*]    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
[*]</listener>
[*]<context-param>
[*]    <param-name>contextConfigLocation</param-name>
[*]    <param-value>/WEB-INF/demo.xml</param-value>
[*]</context-param>
[*]<servlet>
[*]    <servlet-name>springContent</servlet-name>
[*]    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
[*]    <init-param>
[*]      <param-name>contextConfigLocation</param-name>
[*]      <param-value>/WEB-INF/demo.xml</param-value>
[*]    </init-param>
[*]</servlet>
[*]<servlet-mapping>
[*]    <servlet-name>springContent</servlet-name>
[*]    <url-pattern>*.do</url-pattern>
[*]</servlet-mapping>
[*]<filter>
[*]    <filter-name>DelegatingFilterProxy</filter-name>
[*]    <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
[*]    <init-param>
[*]      <param-name>targetBeanName</param-name>
[*]      <param-value>filter_saveuserinfo</param-value>
[*]    </init-param>
[*]    <init-param>
[*]      <param-name>targetFilterLifecycle</param-name>
[*]      <param-value>true</param-value>
[*]    </init-param>
[*]</filter>
[*]<filter-mapping>
[*]    <filter-name>DelegatingFilterProxy</filter-name>
[*]    <url-pattern>*.do</url-pattern>
[*]</filter-mapping>
[*]</web-app>

<?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?>
<web-app xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xmlns=&quot;http://java.sun.com/xml/ns/javaee&quot; xmlns:web=&quot;http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd&quot; xsi:schemaLocation=&quot;http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd&quot; id=&quot;WebApp_ID&quot; version=&quot;3.0&quot;>
<display-name>springDemo</display-name>
<welcome-file-list>
<welcome-file>index.do</welcome-file>
</welcome-file-list>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/demo.xml</param-value>
</context-param>
<servlet>
<servlet-name>springContent</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/demo.xml</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>springContent</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<filter>
<filter-name>DelegatingFilterProxy</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
<init-param>
<param-name>targetBeanName</param-name>
<param-value>filter_saveuserinfo</param-value>
</init-param>
<init-param>
<param-name>targetFilterLifecycle</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>DelegatingFilterProxy</filter-name>
<url-pattern>*.do</url-pattern>
</filter-mapping>
</web-app>


  
  spring配置文件demo.xml
  


view plaincopyprint?

[*]<?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?>
[*]<beans xmlns=&quot;http://www.springframework.org/schema/beans&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
[*]    xmlns:aop=&quot;http://www.springframework.org/schema/aop&quot; xmlns:cache=&quot;http://www.springframework.org/schema/cache&quot;
[*]    xmlns:context=&quot;http://www.springframework.org/schema/context&quot; xmlns:jdbc=&quot;http://www.springframework.org/schema/jdbc&quot;
[*]    xmlns:jee=&quot;http://www.springframework.org/schema/jee&quot; xmlns:jms=&quot;http://www.springframework.org/schema/jms&quot;
[*]    xmlns:lang=&quot;http://www.springframework.org/schema/lang&quot; xmlns:mvc=&quot;http://www.springframework.org/schema/mvc&quot;
[*]    xmlns:oxm=&quot;http://www.springframework.org/schema/oxm&quot; xmlns:p=&quot;http://www.springframework.org/schema/p&quot;
[*]    xmlns:task=&quot;http://www.springframework.org/schema/task&quot; xmlns:tx=&quot;http://www.springframework.org/schema/tx&quot;
[*]    xmlns:util=&quot;http://www.springframework.org/schema/util&quot;
[*]    xsi:schemaLocation=&quot;http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
[*]      http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
[*]      http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache-3.1.xsd
[*]      http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
[*]      http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.1.xsd
[*]      http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.1.xsd
[*]      http://www.springframework.org/schema/jms http://www.springframework.org/schema/jms/spring-jms-3.1.xsd
[*]      http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-3.1.xsd
[*]      http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd
[*]      http://www.springframework.org/schema/oxm http://www.springframework.org/schema/oxm/spring-oxm-3.1.xsd
[*]      http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.1.xsd
[*]      http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
[*]      http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.1.xsd&quot;>
[*]
[*]    <context:annotation-config />
[*]    <context:component-scan base-package=&quot;com.netel&quot; />
[*]    <aop:aspectj-autoproxy />
[*]      
[*]      
[*]    <!-- C3P0连接池配置 -->
[*]    <bean id=&quot;dataSource&quot; class=&quot;com.mchange.v2.c3p0.ComboPooledDataSource&quot;
[*]      destroy-method=&quot;close&quot;>
[*]      <property name=&quot;driverClass&quot; value=&quot;com.mysql.jdbc.Driver&quot; />
[*]      <property name=&quot;jdbcUrl&quot; value=&quot;jdbc:mysql://localhost:3306/keyword_list&quot; />
[*]      <property name=&quot;user&quot; value=&quot;root&quot; />
[*]      <property name=&quot;password&quot; value=&quot;123456&quot; />
[*]    </bean>
[*]      
[*]    <bean id=&quot;jdbc&quot; class=&quot;org.springframework.jdbc.core.JdbcTemplate&quot;>
[*]      <property name=&quot;dataSource&quot; ref=&quot;dataSource&quot; />
[*]    </bean>
[*]
[*]    <!-- memcache缓存池 -->
[*]    <bean id=&quot;memcachedPool&quot; class=&quot;com.danga.MemCached.SockIOPool&quot;
[*]      factory-method=&quot;getInstance&quot; init-method=&quot;initialize&quot; destroy-method=&quot;shutDown&quot;>
[*]      <constructor-arg>
[*]            <value>neeaMemcachedPool</value>
[*]      </constructor-arg>
[*]      <property name=&quot;servers&quot;>
[*]            <list>
[*]                <value>127.0.0.1:12111</value>
[*]            </list>
[*]      </property>
[*]      <property name=&quot;initConn&quot;>
[*]            <value>20</value>
[*]      </property>
[*]      <property name=&quot;minConn&quot;>
[*]            <value>10</value>
[*]      </property>
[*]      <property name=&quot;maxConn&quot;>
[*]            <value>50</value>
[*]      </property>
[*]      <property name=&quot;maintSleep&quot;>
[*]            <value>30000</value>
[*]      </property>
[*]      <property name=&quot;nagle&quot;>
[*]            <value>false</value>
[*]      </property>
[*]      <property name=&quot;socketTO&quot;>
[*]            <value>3000</value>
[*]      </property>
[*]    </bean>
[*]
[*]    <!-- 缓存客服端 -->
[*]    <bean id=&quot;memcachedClient&quot; class=&quot;com.danga.MemCached.MemCachedClient&quot;>
[*]      <constructor-arg>
[*]            <value>neeaMemcachedPool</value>
[*]      </constructor-arg>
[*]    </bean>
[*]         
[*]</beans>

<?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?>
<beans xmlns=&quot;http://www.springframework.org/schema/beans&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
xmlns:aop=&quot;http://www.springframework.org/schema/aop&quot; xmlns:cache=&quot;http://www.springframework.org/schema/cache&quot;
xmlns:context=&quot;http://www.springframework.org/schema/context&quot; xmlns:jdbc=&quot;http://www.springframework.org/schema/jdbc&quot;
xmlns:jee=&quot;http://www.springframework.org/schema/jee&quot; xmlns:jms=&quot;http://www.springframework.org/schema/jms&quot;
xmlns:lang=&quot;http://www.springframework.org/schema/lang&quot; xmlns:mvc=&quot;http://www.springframework.org/schema/mvc&quot;
xmlns:oxm=&quot;http://www.springframework.org/schema/oxm&quot; xmlns:p=&quot;http://www.springframework.org/schema/p&quot;
xmlns:task=&quot;http://www.springframework.org/schema/task&quot; xmlns:tx=&quot;http://www.springframework.org/schema/tx&quot;
xmlns:util=&quot;http://www.springframework.org/schema/util&quot;
xsi:schemaLocation=&quot;http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache-3.1.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.1.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.1.xsd
http://www.springframework.org/schema/jms http://www.springframework.org/schema/jms/spring-jms-3.1.xsd
http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-3.1.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd
http://www.springframework.org/schema/oxm http://www.springframework.org/schema/oxm/spring-oxm-3.1.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.1.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.1.xsd&quot;>
<context:annotation-config />
<context:component-scan base-package=&quot;com.netel&quot; />
<aop:aspectj-autoproxy />

<!-- C3P0连接池配置 -->
<bean id=&quot;dataSource&quot; class=&quot;com.mchange.v2.c3p0.ComboPooledDataSource&quot;
destroy-method=&quot;close&quot;>
<property name=&quot;driverClass&quot; value=&quot;com.mysql.jdbc.Driver&quot; />
<property name=&quot;jdbcUrl&quot; value=&quot;jdbc:mysql://localhost:3306/keyword_list&quot; />
<property name=&quot;user&quot; value=&quot;root&quot; />
<property name=&quot;password&quot; value=&quot;123456&quot; />
</bean>
<bean id=&quot;jdbc&quot; class=&quot;org.springframework.jdbc.core.JdbcTemplate&quot;>
<property name=&quot;dataSource&quot; ref=&quot;dataSource&quot; />
</bean>
<!-- memcache缓存池 -->
<bean id=&quot;memcachedPool&quot; class=&quot;com.danga.MemCached.SockIOPool&quot;
factory-method=&quot;getInstance&quot; init-method=&quot;initialize&quot; destroy-method=&quot;shutDown&quot;>
<constructor-arg>
<value>neeaMemcachedPool</value>
</constructor-arg>
<property name=&quot;servers&quot;>
<list>
<value>127.0.0.1:12111</value>
</list>
</property>
<property name=&quot;initConn&quot;>
<value>20</value>
</property>
<property name=&quot;minConn&quot;>
<value>10</value>
</property>
<property name=&quot;maxConn&quot;>
<value>50</value>
</property>
<property name=&quot;maintSleep&quot;>
<value>30000</value>
</property>
<property name=&quot;nagle&quot;>
<value>false</value>
</property>
<property name=&quot;socketTO&quot;>
<value>3000</value>
</property>
</bean>
<!-- 缓存客服端 -->
<bean id=&quot;memcachedClient&quot; class=&quot;com.danga.MemCached.MemCachedClient&quot;>
<constructor-arg>
<value>neeaMemcachedPool</value>
</constructor-arg>
</bean>
</beans>


controller  
  


view plaincopyprint?

[*]package com.netel.web;
[*]
[*]import javax.annotation.Resource;
[*]import javax.servlet.http.HttpServletRequest;
[*]import javax.servlet.http.HttpServletResponse;
[*]
[*]import org.springframework.stereotype.Controller;
[*]import org.springframework.web.bind.annotation.RequestMapping;
[*]import org.springframework.web.servlet.ModelAndView;
[*]
[*]import com.danga.MemCached.MemCachedClient;
[*]import com.netel.dao.GetKeyword;
[*]
[*]@Controller
[*]public class Controller_index {
[*]      
[*]    @Resource(name=&quot;memcachedClient&quot;)
[*]    private MemCachedClient client;
[*]      
[*]    @Resource(name=&quot;keyword_dao&quot;)
[*]    private GetKeyword dao;
[*]      
[*]    public void setClient(MemCachedClient client) {
[*]      this.client = client;
[*]    }
[*]
[*]    public void setDao(GetKeyword dao) {
[*]      this.dao = dao;
[*]    }
[*]
[*]
[*]    @RequestMapping(&quot;/index.do&quot;)
[*]    public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
[*]      ModelAndView v = new ModelAndView(&quot;index.jsp&quot;);
[*]      System.out.println(&quot;进入controller&quot;);
[*]      String tmp1 = &quot;controller    &quot; &#43; client;
[*]      String tmp2 = &quot;controller    &quot; &#43; dao.getAllData();
[*]      String tmp3 = &quot;controller    &quot; &#43;request.getParameter(&quot;name&quot;);
[*]         
[*]      System.out.println(tmp1);
[*]      System.out.println(tmp2);
[*]      System.out.println(tmp3);
[*]         
[*]      v.addObject(&quot;tmp1&quot;, tmp1);
[*]      v.addObject(&quot;tmp2&quot;, tmp2);
[*]      v.addObject(&quot;tmp3&quot;, tmp3);
[*]      return v;
[*]    }
[*]}
  
  filter
  


view plaincopyprint?

[*]package com.netel.web;
[*]
[*]import java.io.IOException;
[*]
[*]import javax.annotation.Resource;
[*]import javax.servlet.Filter;
[*]import javax.servlet.FilterChain;
[*]import javax.servlet.FilterConfig;
[*]import javax.servlet.ServletException;
[*]import javax.servlet.ServletRequest;
[*]import javax.servlet.ServletResponse;
[*]
[*]import org.springframework.stereotype.Component;
[*]
[*]import com.danga.MemCached.MemCachedClient;
[*]import com.netel.dao.GetKeyword;
[*]
[*]
[*]@Component(&quot;filter_saveuserinfo&quot;)
[*]public class Filter_saveUserInfo implements Filter {
[*]      
[*]    @Resource(name=&quot;memcachedClient&quot;)
[*]    private MemCachedClient client;
[*]      
[*]    @Resource(name=&quot;keyword_dao&quot;)
[*]    private GetKeyword dao;
[*]      
[*]    public void setClient(MemCachedClient client) {
[*]      this.client = client;
[*]    }
[*]
[*]    public void setDao(GetKeyword dao) {
[*]      this.dao = dao;
[*]    }
[*]      
[*]      
[*]    /**
[*]   * Default constructor.   
[*]   */
[*]    public Filter_saveUserInfo() {
[*]    }
[*]
[*]    /**
[*]   * @see Filter#destroy()
[*]   */
[*]    public void destroy() {
[*]    }
[*]
[*]    /**
[*]   * @see Filter#doFilter(ServletRequest, ServletResponse, FilterChain)
[*]   */
[*]    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
[*]      System.out.println(&quot;进入filter\t&quot;&#43; client &#43; &quot;\t&quot; &#43; dao);      
[*]                chain.doFilter(request, response);
[*]    }
[*]
[*]    /**
[*]   * @see Filter#init(FilterConfig)
[*]   */
[*]    public void init(FilterConfig fConfig) throws ServletException {
[*]    }
[*]
[*]}
  dao随便写了查询方法


  
  


view plaincopyprint?

[*]package com.netel.dao;
[*]
[*]import java.sql.ResultSet;
[*]import java.sql.SQLException;
[*]import java.util.HashMap;
[*]
[*]import javax.annotation.Resource;
[*]
[*]import org.springframework.dao.DataAccessException;
[*]import org.springframework.jdbc.core.JdbcTemplate;
[*]import org.springframework.jdbc.core.ResultSetExtractor;
[*]import org.springframework.stereotype.Repository;
[*]
[*]@Repository(&quot;keyword_dao&quot;)
[*]public class GetKeyword_imple implements GetKeyword {
[*]      
[*]    @Resource(name=&quot;jdbc&quot;)
[*]    private JdbcTemplate jdbc;
[*]
[*]    public void setJdbc(JdbcTemplate jdbc) {
[*]      this.jdbc = jdbc;
[*]    }
[*]
[*]
[*]    @Override
[*]    public HashMap<String, String> getAllData() {
[*]      String sql = &quot;SELECT keyword, count( keyword ) as qty FROM keyword_list GROUP BY keyword ORDER BY qty DESC&quot;;
[*]      return (HashMap<String, String>) jdbc.query(sql, new ResultSetExtractor<HashMap<String, String>>(){
[*]
[*]            @Override
[*]            public HashMap<String, String> extractData(ResultSet rs)
[*]                  throws SQLException, DataAccessException {
[*]                  
[*]                HashMap<String, String> map = new HashMap<String, String>();
[*]                while (rs.next()) {
[*]                  map.put(rs.getString(&quot;keyword&quot;),rs.getString(&quot;qty&quot;));
[*]                }
[*]                return map;
[*]            }
[*]      });
[*]    }
[*]
[*]}
  
  AOP
  


view plaincopyprint?

[*]package com.netel.service;
[*]
[*]import javax.annotation.Resource;
[*]
[*]import org.aspectj.lang.ProceedingJoinPoint;
[*]import org.aspectj.lang.annotation.After;
[*]import org.aspectj.lang.annotation.AfterThrowing;
[*]import org.aspectj.lang.annotation.Around;
[*]import org.aspectj.lang.annotation.Aspect;
[*]import org.aspectj.lang.annotation.Before;
[*]import org.springframework.stereotype.Component;
[*]
[*]import com.danga.MemCached.MemCachedClient;
[*]import com.netel.dao.GetKeyword;
[*]
[*]@Aspect
[*]@Component
[*]public class AOP_loginfo {
[*]      
[*]    @Resource(name=&quot;memcachedClient&quot;)
[*]    private MemCachedClient client;
[*]      
[*]    @Resource(name=&quot;keyword_dao&quot;)
[*]    private GetKeyword dao;
[*]      
[*]    public void setClient(MemCachedClient client) {
[*]      this.client = client;
[*]    }
[*]
[*]    public void setDao(GetKeyword dao) {
[*]      this.dao = dao;
[*]    }
[*]
[*]    /**
[*]   * 所有带RequestMapping注解的方法
[*]   */
[*]    private final static String el = &quot;@annotation(org.springframework.web.bind.annotation.RequestMapping)&quot;;
[*]
[*]    @Before(el)
[*]    public void before() {
[*]      System.out.println(&quot;before\t&quot; &#43; client &#43; &quot;\t&quot; &#43; dao);
[*]    }
[*]
[*]    @After(el)
[*]    public void after() {
[*]      System.out.println(&quot;after\t&quot; &#43; client &#43; &quot;\t&quot; &#43; dao);
[*]    }
[*]
[*]    @Around(el)
[*]    public Object around(ProceedingJoinPoint p) {
[*]      for (Object obj : p.getArgs()) {
[*]            System.out.println(&quot;参数:&quot; &#43; obj);
[*]      }
[*]      Object ob = null;
[*]
[*]      try {
[*]            System.out.println(&quot;around前\t&quot; &#43; client &#43; &quot;\t&quot; &#43; dao);
[*]            ob = p.proceed();
[*]            System.out.println(&quot;around后\t&quot; &#43; client &#43; &quot;\t&quot; &#43; dao);
[*]      } catch (Throwable e) {
[*]            e.printStackTrace();
[*]      }
[*]
[*]      return ob;
[*]    }
[*]      
[*]    @AfterThrowing(value = el, throwing=&quot;e&quot;)
[*]    public void throwing(Exception e){
[*]      System.out.println(&quot;出异常了&quot;&#43; client &#43; &quot;\t&quot; &#43; dao &#43; e);
[*]    }
[*]
[*]}
  
  index.jsp
  


view plaincopyprint?

[*]<%@ page language=&quot;java&quot; contentType=&quot;text/html; charset=UTF-8&quot;
[*]    pageEncoding=&quot;UTF-8&quot; isELIgnored=&quot;false&quot;%>
[*]<!DOCTYPE html PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot; &quot;http://www.w3.org/TR/html4/loose.dtd&quot;>
[*]<html>
[*]<head>
[*]<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot;>
[*]<title>Insert title here</title>
[*]</head>
[*]<body>
[*]    wca..........<br>
[*]    ${tmp1 }<br>
[*]    ${tmp2 }<br>
[*]    ${tmp3 }<br>
[*]      
[*]    <%=request.getAttribute(&quot;tmp1&quot;) %> <br>
[*]    <%=request.getAttribute(&quot;tmp2&quot;) %> <br>
[*]    <%=request.getAttribute(&quot;tmp3&quot;) %> <br>
[*]</body>
[*]</html>

发布。运行。控制台输出  
  
  


view plaincopyprint?

[*]进入filter    com.danga.MemCached.MemCachedClient@e6529ccom.netel.dao.GetKeyword_imple@1399ae5
[*]beforecom.danga.MemCached.MemCachedClient@e5f1d   com.netel.dao.GetKeyword_imple@1869929
[*]参数:org.apache.catalina.connector.RequestFacade@1b15387
[*]参数:org.apache.catalina.connector.ResponseFacade@e2da7a
[*]around前 com.danga.MemCached.MemCachedClient@e5f1d   com.netel.dao.GetKeyword_imple@1869929
[*]进入controller
[*]controller    com.danga.MemCached.MemCachedClient@e5f1d
[*]controller    {3=6, 2=4, AA=1, 1=11, 111=1, 4=1, 中=3}
[*]controller    null
[*]after   com.danga.MemCached.MemCachedClient@e5f1d   com.netel.dao.GetKeyword_imple@1869929
[*]around后 com.danga.MemCached.MemCachedClient@e5f1d   com.netel.dao.GetKeyword_imple@1869929
  
  index.jsp页面输出
  
  


view plaincopyprint?

[*]wca..........
[*]controller com.danga.MemCached.MemCachedClient@e5f1d
[*]controller {3=6, 2=4, AA=1, 1=11, 111=1, 4=1, 中=3}
[*]controller null
[*]controller com.danga.MemCached.MemCachedClient@e5f1d
[*]controller {3=6, 2=4, AA=1, 1=11, 111=1, 4=1, 中=3}
[*]controller null
  
  改变URL地址


  
  


view plaincopyprint?

[*]http://localhost:8080/AnnotationDemo/index.do?name=aaa

JSP页面  
  


view plaincopyprint?

[*]wca..........
[*]controller com.danga.MemCached.MemCachedClient@e5f1d
[*]controller {3=6, 2=4, AA=1, 1=11, 111=1, 4=1, 中=3}
[*]controller aaa
[*]controller com.danga.MemCached.MemCachedClient@e5f1d
[*]controller {3=6, 2=4, AA=1, 1=11, 111=1, 4=1, 中=3}
[*]controller aaa

完成。。
版权声明:本文为博主原创文章,未经博主允许不得转载。
页: [1]
查看完整版本: spring 3.1.0.M 注解MVC + filter + AOP + memcache + C3P0