This content has been marked as final.
Show 3 replies
-
1. Re: Performance and ajax request content
ronanker Feb 11, 2009 11:46 AM (in response to ronanker)Is there someone from the richfaces team that can explain us the following principle:
quoted from http://livedemo.exadel.com/richfaces-demo/richfaces/ajaxAttributes.jsf?c=ajaxattributes&tab=usage:Data Processing Options
"RichFaces uses form based approach for Ajax request sending.[...]
ajaxSingle - boolean attribute which provides possibility to limit JSF tree processing(decoding, conversion/validation, value applying) to the component which send the request only. "
To make things clear, it seems that all ajax requests always send the closest form with all its inputs whatever the "ajaxSingle" attribute or is set or not.
If I'm right, why RC send all the inputs if they are ignored on server side ?
Once again, I'm asking if there any mean to send an ajax request from a given form but without sending the data of the form ?
thanks for any answer. -
2. Re: Performance and ajax request content
nbelaevski Feb 11, 2009 7:45 PM (in response to ronanker)For the first post:
<h:form id="form"> <a4j:loadScript src="resource:///org.ajax4jsf.javascript.PrototypeScript" /> <script type="text/javascript">/*<![CDATA[*/ function addInput(elt) { var inputId = elt.id.replace(/\:text$/, ":input"); var input = $(inputId); if (!input) { Element.insert(elt, {after: "<input type='text' onblur='var elt = $(\"" + elt.id + "\"); elt.innerHTML = this.value; Element.hide(this); Element.show(elt);' name='" + inputId + "' id='" + inputId + "' />"}); } input = $(inputId); input.value = elt.innerHTML; Element.hide(elt); Element.show(input); input.focus(); } /*]]>*/</script> <a4j:repeat id="repeat" var="item" value="#{forum5Bean.data}"> <h:inputText value="#{item.value}" id="input" rendered="#{empty renderPhase and param[rich:clientId('input')] != null}" /> <a4j:outputPanel onclick="addInput(this)" id="text"> <h:outputText value="#{item.value} " /> </a4j:outputPanel> <br /> </a4j:repeat> <h:commandLink value="Submit" /> </h:form>
Phase listener class:package demo; import javax.faces.event.PhaseEvent; import javax.faces.event.PhaseId; import javax.faces.event.PhaseListener; public class RenderPhaseListener implements PhaseListener { public void afterPhase(PhaseEvent event) { } public void beforePhase(PhaseEvent event) { event.getFacesContext().getExternalContext().getRequestMap().put("renderPhase", Boolean.TRUE); } public PhaseId getPhaseId() { return PhaseId.RENDER_RESPONSE; } }
-
3. Re: Performance and ajax request content
nbelaevski Feb 11, 2009 8:58 PM (in response to ronanker)A bit enhanced page:
<h:form id="form"> <a4j:loadScript src="resource:///org.ajax4jsf.javascript.PrototypeScript" /> <script type="text/javascript">/*<![CDATA[*/ function addInput(elt) { var inputId = elt.id.replace(/\:text$/, ":input"); var input = $(inputId); if (!input) { Element.insert(elt, {after: "<input type='text' onblur='var elt = $(\"" + elt.id + "\"); elt.innerHTML = this.value; Element.hide(this); Element.show(elt);' name='" + inputId + "' id='" + inputId + "' />"}); } input = $(inputId); input.value = elt.innerHTML; Element.hide(elt); Element.show(input); input.focus(); } /*]]>*/</script> <a4j:repeat id="repeat" var="item" value="#{forum5Bean.data}" rowKeyVar="rk"> <c:set var="clientId" value="form:repeat:#{rk}:input"/> <h:inputText value="#{item.value}" id="input" rendered="#{empty renderPhase and param[clientId] != null}" /> <a4j:outputPanel onclick="addInput(this)" id="text"> <h:outputText value="#{item.value}" /> </a4j:outputPanel> <br /> </a4j:repeat> <h:commandLink value="Submit" /> </h:form>