浏览 3041 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2008-08-25
<?xml version="1.0"?> <!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN" "http://java.sun.com/dtd/web-facesconfig_1_1.dtd"> <faces-config> <application> <view-handler>com.xxx.framework.jsf.viewhandler.XxxJspDynamicViewerHandler</view-handler> <state-manager>com.xxx.framework.jsf.XxxAjaxStateManager</state-manager> </application> </faces-config> package com.Xxx.framework.jsf.viewhandler; import javax.faces.context.FacesContext; import org.apache.myfaces.application.jsp.JspViewHandlerImpl; import com.xxx.framework.constant.FwkConstant; import com.xxx.framework.logging.AppLogFactory; import com.xxx.framework.logging.ILog; public class XxxJspDynamicViewerHandler extends JspViewHandlerImpl { // For logging: private final ILog log = AppLogFactory.getLog(XxxJspDynamicViewerHandler.class, FwkConstant.MODULE_SECURITY); public String getActionURL(FacesContext facesContext, String viewId) { String path = ""; int nIndexOfFollowingParamSign = -1; if ( XxxJspDynamicViewerHandler.containsXxxJspViewHandlerImpIndicator(viewId) ) { nIndexOfFollowingParamSign = viewId.indexOf("?"); if ( -1 != nIndexOfFollowingParamSign) { path = super.getActionURL(facesContext, viewId) + viewId.substring(nIndexOfFollowingParamSign); } // end if } // end if if ( path != null && path.length() == 0 ) { path = super.getActionURL(facesContext, viewId); } return path; } public static boolean containsXxxJspViewHandlerImpIndicator(String paramStr) { return ((null != paramStr) && (paramStr.indexOf(FwkConstant.Xxx_VIEWHANDLER_INDICATOR) != -1)) ? true : false; } } package com.Xxx.framework.jsf; import javax.faces.application.StateManager; import javax.faces.context.ExternalContext; import org.ajax4jsf.application.AjaxStateManager; public class XxxAjaxStateManager extends AjaxStateManager{ private static final String VIEW_PARAM_KEY = "com.wtt.framework.NUMBER_OF_STATES_IN_VIEW"; private int numberOfViews = -1; public XxxAjaxStateManager(StateManager stateManager) { super(stateManager); } @Override protected int getNumberOfViews(ExternalContext externalContext) { if (this.numberOfViews == -1) { if (externalContext.getInitParameter(VIEW_PARAM_KEY) != null) { try { this.numberOfViews = Integer.valueOf(externalContext.getInitParameter(VIEW_PARAM_KEY)); } catch (NumberFormatException nfe) { this.numberOfViews = super.getNumberOfViews(externalContext); } } } return this.numberOfViews; } } 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |
发表时间:2008-08-25
没人可以指点一下吗?
|
|
返回顶楼 | |
发表时间:2008-08-26
是不是我没把问题说清楚啊?
|
|
返回顶楼 | |