private static ThreadLocal pageHolder = new ThreadLocal();
public static Page getPage() {
Page page = pageHolder.get();
if (page == null) {
page = new Page();
pageHolder.set(page);
}
return page;
}
private static ThreadLocal pageHolder = new ThreadLocal();
public static Page getPage() {
Page page = pageHolder.get();
if (page == null) {
page = new Page();
pageHolder.set(page);
}
return page;
}
public class PageFilter implements ActionFilter {
@Override
public View match(ActionContext actionContext) {
HttpServletRequest request = actionContext.getRequest();
String iDisplayStart1 = request.getParameter("iDisplayStart");
String iDisplayLength1 = request.getParameter("iDisplayLength");
String sEcho1 = request.getParameter("sEcho");
if (iDisplayStart1 != null && iDisplayLength1 != null && sEcho1 != null) {
Integer iDisplayStart = Integer.parseInt("1");
Integer iDisplayLength = Integer.parseInt("1");
Integer sEcho = Integer.parseInt(sEcho1);
Page page = PageContext.getPage();
page.setDisplayLength(iDisplayLength);
page.setDisplayStart(iDisplayStart);
page.setsEcho(sEcho);
}
return null;
}
我在过滤器中 赋值后,在其他方法中取出来是空