本文整理汇总了Java中javax.faces.application.ConfigurableNavigationHandler.getNavigationCase方法的典型用法代码示例。如果您正苦于以下问题:Java ConfigurableNavigationHandler.getNavigationCase方法的具体用法?Java ConfigurableNavigationHandler.getNavigationCase怎么用?Java ConfigurableNavigationHandler.getNavigationCase使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.faces.application.ConfigurableNavigationHandler
的用法示例。
在下文中一共展示了ConfigurableNavigationHandler.getNavigationCase方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: determineTargetURL
import javax.faces.application.ConfigurableNavigationHandler; //导入方法依赖的package包/类
/**
* Translate the outcome attribute value to the target URL.
*
* @param context
* the current FacesContext
* @param outcome
* the value of the outcome attribute
* @return the target URL of the navigation rule (or the outcome if there's
* not navigation rule)
*/
private String determineTargetURL(FacesContext context, Button button, String outcome) {
ConfigurableNavigationHandler cnh = (ConfigurableNavigationHandler) context.getApplication()
.getNavigationHandler();
NavigationCase navCase = cnh.getNavigationCase(context, null, outcome);
/*
* Param Name: javax.faces.PROJECT_STAGE Default Value: The default
* value is ProjectStage#Production but IDE can set it differently in
* web.xml Expected Values: Development, Production, SystemTest,
* UnitTest Since: 2.0
*
* If we cannot get an outcome we use an Alert to give a feedback to the
* Developer if this build is in the Development Stage
*/
if (navCase == null) {
if (FacesContext.getCurrentInstance().getApplication().getProjectStage().equals(ProjectStage.Development)) {
return "alert('WARNING! " + C.W_NONAVCASE_BUTTON + "');";
} else {
return "";
}
} // throw new FacesException("The outcome '"+outcome+"' cannot be
// resolved."); }
String vId = navCase.getToViewId(context);
Map<String, List<String>> params = getParams(navCase, button);
String url;
url = context.getApplication().getViewHandler().getBookmarkableURL(context, vId, params,
button.isIncludeViewParams() || navCase.isIncludeViewParams());
return url;
}
示例2: encodeHref
import javax.faces.application.ConfigurableNavigationHandler; //导入方法依赖的package包/类
private String encodeHref(FacesContext context, AbstractNavLink navlink) {
String href = navlink.getHref();
String url;
if (href != null) {
url = getResourceURL(context, href);
return url;
} else {
String outcome = navlink.getOutcome();
if (outcome==null) {
return null;
}
ConfigurableNavigationHandler cnh = (ConfigurableNavigationHandler) context.getApplication()
.getNavigationHandler();
NavigationCase navCase = cnh.getNavigationCase(context, null, outcome);
if (navCase == null) {
return null;
}
String vId = navCase.getToViewId(context);
Map<String, List<String>> params = getParams(navCase, navlink);
url = context.getApplication().getViewHandler().getBookmarkableURL(context, vId, params,
navlink.isIncludeViewParams() || navCase.isIncludeViewParams());
if (url != null) {
String frag = navlink.getFragment();
if (frag != null) {
url += "#" + frag;
}
return url;
} else {
return "#";
}
}
}