cms建设网站,如何申请企业邮箱,网站支付接口如何做,四川城乡与建设厅网站Ajax4jsf 允许开发人员将 Ajax 功能添加到 JSF 应用程序中#xff0c;而不需要 JavaScript 或用 Ajax 图形部件替换现有的组件。这个包还允许在使用 Java 2D 库时动态地生成图像。Ajax 是一种编程技术#xff0c;它处理只有页面的一部分需要处理而不需要重新装载整个页面的情…Ajax4jsf 允许开发人员将 Ajax 功能添加到 JSF 应用程序中而不需要 JavaScript 或用 Ajax 图形部件替换现有的组件。这个包还允许在使用 Java 2D 库时动态地生成图像。Ajax 是一种编程技术它处理只有页面的一部分需要处理而不需要重新装载整个页面的情况。这种方式的好处包括减少服务器上的处理时间以及加快客户端的响应速度。 与 Tomahawk 相似Ajax4jsf 提供了一套可以很容易地与 JSF 标记一起使用的标记。在本教程后面对 Developer Forum Signup 示例应用程序进行改进时将讨论这些标记的示例以及如何将 Ajax4jsf 与 Eclipse 进行集成。接下来将学习组成这个库的每个组件、在使用它时必须记住的限制以及如何在 Eclipse 项目中添加 Ajax4jsf。 组件 Ajax4jsf 组件被设计成可以轻松地与现有的 JSF 应用程序进行集成同时提供了改进性能的 Ajax 功能。表 1 中描述了 Ajax4jsf 库中包含的所有标记。 表 1. Ajax4jsf 库标记 Ajax4jsf 组件描述a4j:actionListener其效果类似于 JSF 中的 f:actionListener 或 f:valueChangeListener 标记但是它用于 Ajax 容器。a4j:actionparam结合了 f:actionListener 和 f:param JSF 标记的功能。a4j:commandButton效果类似于被点击时的表单 Submit 按钮但是呈现为 HTML input 标记。a4j:commandLink效果类似于被点击时的表单 Submit 按钮但是呈现为 HTML a 锚标记。a4j:loadBundle装载当前视图的本地化资源束。a4j:mediaOutput允许创建动态生成的内容。a4j:outputPanel在页面上创建一个启用 Ajax 的部分允许这个区域中的内容重新呈现即使导致 Ajax 请求的组件没有专门提到这个区域。a4j:page呈现完整的 HTML 页面结构。但是它必须是 JSF f:view 标记的第一个和惟一的子元素在它外边不能有 HTML 代码。a4j:region决定 JSF f:view 的哪个部分将通过为相关联的 Ajax 请求提供内容来处理。这会只更新页面中需要更新的部分从而改进性能。a4j:status通过指出请求何时开始或结束提供关于指定区域的 Ajax 请求的客户端状态。a4j:support将 Ajax 功能添加到与 JSF 相关的组件中。这个标记可能是最常用的。根据场景某些组件会比其他组件更常用。接下来将学习在使用 Ajax4jsf 时必须记住的条件。 例子 % taglib uri/WEB-INF/ajax4jsf.tld prefixa4j%
html
a4j:loadBundle basenamecom.jci.fi.application.cbs.resources.cbsLiteResources varrb /
headh:form idchildContractForm h:panelGrid columns2 columnClasseswidthCol200px,widthCol200pxh:outputText value#{rb[label.branch]} styleClasssetLabel /h:panelGroup idchildBrancha4j:regionh:panelGroup idbranchInp1 styledisplay:table-cell;vertical-align:middle;h:inputText idbranch styleClasssetText branch value#{prebookFacesBean.currentChildContract.jciBranchNumber} size3 maxlength3 οnblurhandleBranchChange();/h:inputTexth:inputHidden id branchOrgid value #{prebookFacesBean.dataBean.executingBranch.orgId}/h:inputHidden !--end Willie 7/12/2017 2:13 --rich:suggestionbox idsuggestionBoxBranchNbr styleClasssuggestionBoxBranchNbr forbranch suggestionAction#{areaBean.autocompleteBranchForPreBookingChildContract} varbranch fetchValue#{branch.branchNumber} minChars1 statuswaitStatusNoBlock eventsQueuequeueBranch ignoreDupResponsestrue οnselectrefreshChildLob(); shadowOpacity4 border1 width300 height150 shadowDepth4 cellpadding2nothingLabel#{rb[message.noBranch]}h:columnh:outputText value#{branch.branchNumber} //h:columnh:columnh:outputText value#{branch.branchName} stylefont-style:italic //h:columnh:columnh:outputText value (#{rb[label.region]}: #{branch.areaNumber}) stylefont-style:italic //h:column/rich:suggestionbox/h:panelGrouph:panelGroup idbranchInp2 styledisplay:table-cell;vertical-align:middle;h:graphicImage idbranchLookUp stylecursor: pointer;margin-left: 3px; value/images/lookup.gif alt#{rb[label.lookUp]} οnclickjavascript:launchABWindow(child);//h:panelGrouph:panelGroup idbranchInp3 styledisplay:table-cell;vertical-align:middle;h:outputText valueInvalid Branch stylecolor:red;margin-left:5px; rendered#{prebookFacesBean.branchNotFound}/h:outputText/h:panelGroup/a4j:region/h:panelGrouph:outputText value#{rb[label.lineOfBusiness]} styleClasssetLabel /h:selectOneMenu idchildLob styleClasssetText lob value#{prebookFacesBean.currentChildContract.jciLineOfBusiness.lob}f:selectItems value#{prebookFacesBean.lobsListSelectItems} //h:selectOneMenuh:outputText value#{rb[label.contractTypeBL]} styleClasssetLabel /h:selectOneMenu idchildtype styleClasssetText type value#{prebookFacesBean.currentChildContract.contractType.contractType}f:selectItems value#{prebookFacesBean.childContractTypesListSelectItems} /a4j:support eventonchange action#{prebookFacesBean.changeChildContractType} ajaxSingletrue reRenderpreenter/a4j:support/h:selectOneMenuh:outputText value#{rb[label.contractName]} styleClasssetLabel /h:inputText idname styleClasssetText name value#{prebookFacesBean.currentChildContract.contractName} maxlength27/h:inputTexth:outputText value#{rb[label.preEnterOpenForCost]}? styleClasssetLabel /h:selectBooleanCheckbox idpreenter value#{prebookFacesBean.currentChildContract.preEnter} disabled#{prebookFacesBean.childContractPreenterDisabled} rendered#{prebookFacesBean.userCanPreenter} οnclickisPreenterdChild(this.checked);/h:selectBooleanCheckboxh:outputText value#{rb[label.no]} rendered#{!prebookFacesBean.userCanPreenter}/h:outputText/h:panelGridrich:panel idbutnsPn styleborder-width: 0px; margin: 0px; text-align: center; width: 99%;a4j:commandButton idsave statuswaitStatus typebutton styleClassbutton action#{prebookFacesBean.saveChildContract} οnclickif(!validateChildContractPopup()) return false;value#{rb[button.save]} reRenderchildList,ds oncompleteRichfaces.hideModalPanel(childContractMP);/a4j:commandButtonh:outputText value escapefalse/h:outputTexta4j:commandButton idcancel typebutton styleClassbutton value#{rb[button.cancel]} οnclickRichfaces.hideModalPanel(childContractMP);return false;/a4j:commandButton/rich:panela4j:jsFunction ajaxSingletrue namerefreshChildLob reRenderchildLob, childBranch action#{prebookFacesBean.populateLobs} processbranch/a4j:jsFunction/h:form a4j:regionh:panelGroup idbranchInp1 styledisplay:table-cell;vertical-align:middle;h:inputText idbranch1 styleClasssetText branch value#{prebookFacesBean.contractNumber} size3 /h:inputTexth:inputText idbranch2 styleClasssetText branch value#{prebookFacesBean.contractName} size3 /h:inputTexth:inputText idbranch styleClasssetText branch value#{prebookFacesBean.psaBranchNumber} size3 maxlength3/h:inputTexth:inputHidden id branchOrgid value #{prebookFacesBean.dataBean.executingBranch.orgId}/h:inputHidden%-- h:inputText idbranch1 styleClasssetText branch value size3 maxlength3/h:inputTexth:inputHidden id branchOrgid1 value #{prebookFacesBean.dataBean.executingBranch.orgId}/h:inputHidden --% rich:suggestionbox idsuggestionBoxBranchNbr2 forbranch suggestionAction#{areaBean.autocompleteBranchForPreBookingPSAContract} varbranch fetchValue#{branch.branchNumber} minChars1 statuswaitStatusNoBlock eventsQueuequeueBranch ignoreDupResponsestrue shadowOpacity4 border1 width300 height150 shadowDepth4 cellpadding2nothingLabel#{rb[message.noBranch]}h:columnh:outputText value#{branch.branchNumber} //h:columnh:columnh:outputText value#{branch.branchName} stylefont-style:italic //h:columnh:columnh:outputText value (#{rb[label.region]}: #{branch.areaNumber}) stylefont-style:italic //h:column/rich:suggestionbox /h:panelGrouph:panelGroup idbranchInp2 styledisplay:table-cell;vertical-align:middle;h:graphicImage idbranchLookUp stylecursor: pointer;margin-left: 3px; value/images/lookup.gif alt#{rb[label.lookUp]} οnclickjavascript:launchABWindow(psa);//h:panelGrouph:panelGroup idbranchInp3 styledisplay:table-cell;vertical-align:middle;a4j:commandButton idgetPSA action#{prebookFacesBean.lookupPSAContracts} reRenderavailablePSARes,availablePSANoRes statuswaitStatus value#{rb[label.submit]} stylemargin-left: 10px; typebutton styleClassbutton/a4j:commandButton/h:panelGroup/a4j:region条件 根据 Ajax4jsf 文档所述开发人员必须记住某些限制才能创建正确的 Ajax 和 JSF 应用程序 Ajax4jsf 框架并不在页面上追加或删除元素它只会替换页面上的元素。要想在页面上追加代码应该使用一个空元素标出它的位置。应该只创建严格的符合标准的 HTML 和 XHTML 代码不要省略任何必需的元素或属性因为 Ajax 请求由 XMLHttpRequest 函数以 XML 格式创建。但是这些请求的 XML 格式可能会避开浏览器中的大多数检验和任何纠正处理。最后大多数 Ajax4jsf 标记有一个属性它指定在发出 Ajax 请求之后要处理的元素的 ID。这些元素的 ID 必须匹配在 Ajax4jsf 标记的属性中指定的 ID只有这样更新才会成功。既然已经了解了组件和使用 Ajax4jsf 的条件就需要将这个库添加到 Eclipse 项目中然后才能对 Developer Forum Signup 应用程序进行改进。转载于:https://www.cnblogs.com/Willie-WangLiang/p/7204981.html