當前位置: 首頁>>代碼示例>>Java>>正文


Java Application.getResourceHandler方法代碼示例

本文整理匯總了Java中javax.faces.application.Application.getResourceHandler方法的典型用法代碼示例。如果您正苦於以下問題:Java Application.getResourceHandler方法的具體用法?Java Application.getResourceHandler怎麽用?Java Application.getResourceHandler使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.faces.application.Application的用法示例。


在下文中一共展示了Application.getResourceHandler方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: encodeBegin

import javax.faces.application.Application; //導入方法依賴的package包/類
@Override
  public void encodeBegin(FacesContext context) throws IOException {
      Application app = context.getApplication();
      ResourceHandler rh = app.getResourceHandler();
  	ResponseWriter responseWriter = context.getResponseWriter();
Resource h5s = rh.createResource("js/html5shiv.js", C.BSF_LIBRARY);
Resource rjs = rh.createResource("js/respond.js", C.BSF_LIBRARY);

responseWriter.write("<!--[if lt IE 9]>");
responseWriter.startElement("script", null);
responseWriter.writeAttribute("src", h5s.getRequestPath(), null);
responseWriter.endElement("script");
responseWriter.startElement("script", null);
responseWriter.writeAttribute("src", rjs.getRequestPath(), null);
responseWriter.endElement("script");
responseWriter.write("<![endif]-->");
  }
 
開發者ID:TheCoder4eu,項目名稱:BootsFaces-OSP,代碼行數:18,代碼來源:InternalIE8CompatiblityLinks.java

示例2: Datepicker

import javax.faces.application.Application; //導入方法依賴的package包/類
public Datepicker() {
	setRendererType(null); // this component renders itself

	AddResourcesListener.addThemedCSSResource("core.css");
	AddResourcesListener.addExtCSSResource("jq.ui.core.css");
	AddResourcesListener.addExtCSSResource("jq.ui.theme.css");
	AddResourcesListener.addExtCSSResource("jq.ui.datepicker.css");

	AddResourcesListener.addResourceToHeadButAfterJQuery(C.BSF_LIBRARY, "jq/ui/core.js");
	AddResourcesListener.addResourceToHeadButAfterJQuery(C.BSF_LIBRARY, "jq/ui/datepicker.js");
	FacesContext context = FacesContext.getCurrentInstance();
	Application app = context.getApplication();
	ResourceHandler rh = app.getResourceHandler();
	Resource rdp;
	Iterator<Locale> preferredLanguages = context.getExternalContext().getRequestLocales();
	while (preferredLanguages.hasNext()) {
		String language = preferredLanguages.next().getLanguage();
		if ("en".equals(language)) {
			break;
		}
		final String jsl = "jq/ui/i18n/datepicker-" + language + ".js";
		rdp = rh.createResource(jsl, C.BSF_LIBRARY);
		if (rdp != null) { // rdp is null if the language .js is not present
							// in jar
			AddResourcesListener.addResourceToHeadButAfterJQuery(C.BSF_LIBRARY, jsl);
			break;
		}

	}
	Tooltip.addResourceFiles();
}
 
開發者ID:TheCoder4eu,項目名稱:BootsFaces-OSP,代碼行數:32,代碼來源:Datepicker.java


注:本文中的javax.faces.application.Application.getResourceHandler方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。