📄 readaction.java
字号:
/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package com.kook.struts.action;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import net.sf.ehcache.Cache;
import net.sf.ehcache.CacheManager;
import net.sf.ehcache.Element;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import com.kook.struts.mode.Student;
import com.kook.struts.plugin.EhcachePlugIn;
/**
* MyEclipse Struts
* Creation date: 01-09-2008
*
* XDoclet definition:
* @struts.action validate="true"
*/
public class ReadAction extends Action {
/*
* Generated Methods
*/
/**
* Method execute
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
*/
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
System.out.println("Entry ReadAction~~~");
CacheManager cacheManager = EhcachePlugIn.getCacheManager();
Cache cache = cacheManager.getCache("sampleCache");
System.out.println("Cache is :"+cache);
System.out.println(DemoAction.EHCACHE_KEY);
Element result = cache.get(DemoAction.EHCACHE_KEY);
List ehcacheList = (List)result.getValue();
Iterator iter = ehcacheList.iterator();
while (iter.hasNext()) {
Student element = (Student) iter.next();
System.out.println("Studeng name is:"+element.getName());
}
cache.flush();
return null;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -