一个jsf的face-config.xml看不懂

刚学习jsf,公司一个jsf工程里的face-config.xml看不懂,请大家指点一下!

<?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;
}
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值