3
我使用JSF 1.2和Richfaces,並且對於每個ajax請求,服務器都發迴響應,這很好,但它也包含所有指向JavaScript文件。我想提高性能,所以我只想要返回<body>
,因爲當用戶登錄時(我的應用程序不安寧),所有javascript文件都已加載到瀏覽器中。我怎樣才能做到這一點?避免richfaces在ajax響應中發送回javascript庫
由於
這是點擊一個按鈕時重新呈現的圖像的響應的一個例子。
<?xml version="1.0"?>
<html lang="nl_NL" xmlns="http://www.w3.org/1999/xhtml"><head><title></title><link class="component" href="/eyeprevent/a4j/s/3_3_3.Finalorg/richfaces/renderkit/html/css/basic_both.xcss/DATB/eAF7sqpgb-jyGdIAFrMEaw__.xhtml" rel="stylesheet" type="text/css" /><link class="component" href="/eyeprevent/a4j/s/3_3_3.Finalorg/richfaces/renderkit/html/css/extended_both.xcss/DATB/eAF7sqpgb-jyGdIAFrMEaw__.xhtml" media="rich-extended-skinning" rel="stylesheet" type="text/css" /><link class="component" href="/eyeprevent/a4j/s/3_3_3.Finalcss/page.xcss/DATB/eAF7sqpgb-jyGdIAFrMEaw__.xhtml" rel="stylesheet" type="text/css" /><script src="/eyeprevent/a4j/g/3_3_3.Finalorg.ajax4jsf.javascript.PrototypeScript.xhtml" type="text/javascript">
</script><script src="/eyeprevent/a4j/g/3_3_3.Finalorg.ajax4jsf.javascript.AjaxScript.xhtml" type="text/javascript">
</script><script src="/eyeprevent/a4j/g/3_3_3.Finalorg.ajax4jsf.javascript.ImageCacheScript.xhtml" type="text/javascript">
</script><script src="/eyeprevent/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/scripts/browser_info.js.xhtml" type="text/javascript">
</script><script src="/eyeprevent/a4j/g/3_3_3.Finalorg/ajax4jsf/javascript/scripts/form.js.xhtml" type="text/javascript">
</script><script src="/eyeprevent/a4j/g/3_3_3.Finalscripts/tabPanel.js.xhtml" type="text/javascript">
</script><link class="component" href="/eyeprevent/a4j/s/3_3_3.Finalcss/tabPanel.xcss/DATB/eAF7sqpgb-jyGdIAFrMEaw__.xhtml" rel="stylesheet" type="text/css" /><script src="/eyeprevent/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/scripts/jquery/jquery.js.xhtml" type="text/javascript">
</script><script src="/eyeprevent/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/scripts/jquery.utils.js.xhtml" type="text/javascript">
</script><script src="/eyeprevent/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/scripts/json/json-mini.js.xhtml" type="text/javascript">
</script><script src="/eyeprevent/a4j/g/3_3_3.Finalorg.ajax4jsf.javascript.DnDScript.xhtml" type="text/javascript">
</script><script src="/eyeprevent/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/scripts/utils.js.xhtml" type="text/javascript">
</script><script src="/eyeprevent/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/scripts/json/json-dom.js.xhtml" type="text/javascript">
</script><script src="/eyeprevent/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/scripts/dnd/dnd-common.js.xhtml" type="text/javascript">
</script><script src="/eyeprevent/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/scripts/dnd/dnd-draggable.js.xhtml" type="text/javascript">
</script><script src="/eyeprevent/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/scripts/dnd/dnd-dropzone.js.xhtml" type="text/javascript">
</script><script src="/eyeprevent/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/scripts/form.js.xhtml" type="text/javascript">
</script><script src="/eyeprevent/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/script/controlUtils.js.xhtml" type="text/javascript">
</script><script src="/eyeprevent/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/scripts/common-scrollable-data-table.js.xhtml" type="text/javascript">
</script><script src="/eyeprevent/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/scripts/extended-data-table.js.xhtml" type="text/javascript">
</script><script src="/eyeprevent/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/scripts/drag-indicator.js.xhtml" type="text/javascript">
</script><script src="/eyeprevent/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/scripts/ext-dt-drag-indicator.js.xhtml" type="text/javascript">
</script><script src="/eyeprevent/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/scripts/ext-dt-simple-draggable.js.xhtml" type="text/javascript">
</script><script src="/eyeprevent/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/scripts/ext-dt-simple-dropzone.js.xhtml" type="text/javascript">
</script><link class="component" href="/eyeprevent/a4j/s/3_3_3.Finalorg/richfaces/renderkit/html/css/dragIndicator.xcss/DATB/eAF7sqpgb-jyGdIAFrMEaw__.xhtml" rel="stylesheet" type="text/css" /><link class="component" href="/eyeprevent/a4j/s/3_3_3.Finalcss/extendedDataTable.xcss/DATB/eAF7sqpgb-jyGdIAFrMEaw__.xhtml" rel="stylesheet" type="text/css" /><script src="/eyeprevent/a4j/g/3_3_3.Finalscripts/menu.js.xhtml" type="text/javascript">
</script><script src="/eyeprevent/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/scripts/context-menu.js.xhtml" type="text/javascript">
</script><script src="/eyeprevent/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/scripts/available.js.xhtml" type="text/javascript">
</script><script src="/eyeprevent/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/scripts/menu.js.xhtml" type="text/javascript">
</script><link class="component" href="/eyeprevent/a4j/s/3_3_3.Finalcss/menucomponents.xcss/DATB/eAF7sqpgb-jyGdIAFrMEaw__.xhtml" rel="stylesheet" type="text/css" /><script src="/eyeprevent/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/scripts/tooltip.js.xhtml" type="text/javascript">
</script><link class="component" href="/eyeprevent/a4j/s/3_3_3.Finalorg/richfaces/renderkit/html/css/tooltip.xcss/DATB/eAF7sqpgb-jyGdIAFrMEaw__.xhtml" rel="stylesheet" type="text/css" /><script src="/eyeprevent/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/scripts/datascroller.js.xhtml" type="text/javascript">
</script><link class="component" href="/eyeprevent/a4j/s/3_3_3.Finalcss/datascroller.xcss/DATB/eAF7sqpgb-jyGdIAFrMEaw__.xhtml" rel="stylesheet" type="text/css" /><script src="/eyeprevent/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/scripts/modalPanel.js.xhtml" type="text/javascript">
</script><script src="/eyeprevent/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/scripts/modalPanelBorders.js.xhtml" type="text/javascript">
</script><link class="component" href="/eyeprevent/a4j/s/3_3_3.Finalorg/richfaces/renderkit/html/css/modalPanel.xcss/DATB/eAF7sqpgb-jyGdIAFrMEaw__.xhtml" rel="stylesheet" type="text/css" /><script src="/eyeprevent/a4j/g/3_3_3.Finalscripts/tiny_mce/tiny_mce_src.js.xhtml" type="text/javascript">
</script><script src="/eyeprevent/a4j/g/3_3_3.Finalscripts/editor.js.xhtml" type="text/javascript">
</script><link class="component" href="/eyeprevent/a4j/s/3_3_3.Finalcss/editor.xcss/DATB/eAF7sqpgb-jyGdIAFrMEaw__.xhtml" rel="stylesheet" type="text/css" /><script src="/eyeprevent/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/scripts/events.js.xhtml" type="text/javascript">
</script><script src="/eyeprevent/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/scripts/scriptaculous/effects.js.xhtml" type="text/javascript">
</script><script src="/eyeprevent/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/scripts/JQuerySpinBtn.js.xhtml" type="text/javascript">
</script><script src="/eyeprevent/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/scripts/calendar.js.xhtml" type="text/javascript">
</script><link class="component" href="/eyeprevent/a4j/s/3_3_3.Finalorg/richfaces/renderkit/html/css/calendar.xcss/DATB/eAF7sqpgb-jyGdIAFrMEaw__.xhtml" rel="stylesheet" type="text/css" /><script src="/eyeprevent/a4j/g/3_3_3.Finalscripts/panelbar.js.xhtml" type="text/javascript">
</script><link class="component" href="/eyeprevent/a4j/s/3_3_3.Finalcss/panelbar.xcss/DATB/eAF7sqpgb-jyGdIAFrMEaw__.xhtml" rel="stylesheet" type="text/css" /><script src="/eyeprevent/a4j/g/3_3_3.Finalscripts/comboboxUtils.js.xhtml" type="text/javascript">
</script><script src="/eyeprevent/a4j/g/3_3_3.Finalscripts/utils.js.xhtml" type="text/javascript">
</script><script src="/eyeprevent/a4j/g/3_3_3.Finalscripts/inplaceinputstyles.js.xhtml" type="text/javascript">
</script><script src="/eyeprevent/a4j/g/3_3_3.Finalscripts/inplaceinput.js.xhtml" type="text/javascript">
</script><link class="component" href="/eyeprevent/a4j/s/3_3_3.Finalcss/inplaceinput.xcss/DATB/eAF7sqpgb-jyGdIAFrMEaw__.xhtml" rel="stylesheet" type="text/css" /><script src="/eyeprevent/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/scripts/skinning.js.xhtml" type="text/javascript">
</script><script src="/eyeprevent/a4j/g/3_3_3.Finaljquery.js.xhtml" type="text/javascript">
</script></head>
<body>
<img id="j_id305:supportImage" src="/eyeprevent/image/os-ir-central.jpg" width="50%" />
<meta name="Ajax-Update-Ids" content="j_id305:supportImage" />
<span id="ajax-view-state"><input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="j_id24" autocomplete="off" />
</span><meta id="Ajax-Response" name="Ajax-Response" content="true" />
<meta name="Ajax-Update-Ids" content="j_id305:supportImage" />
<span id="ajax-view-state"><input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="j_id24" autocomplete="off" />
</span><meta id="Ajax-Response" name="Ajax-Response" content="true" />
</body>
</html>
這是生成它的代碼:你對那些由兩個上下文參數(腳本和CSS)的某些控制
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich">
<ui:composition>
<h:form>
<h:panelGrid columns="1">
<a4j:region>
<h:graphicImage id="supportImage" value="#{user.support.imagePath}" rendered="#{user.support.imageLoaded}" width="50%" />
</a4j:region>
<h:panelGroup>
<a4j:commandButton action="#{user.support.acceptImage}" value="YES" reRender="supportImage"/>
<a4j:commandButton action="#{user.support.rejectImage}" value="NO" reRender="supportImage"/>
</h:panelGroup>
</h:panelGrid>
</h:form>
</ui:composition>
</html>