myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Robinson" <andrew.rw.robin...@gmail.com>
Subject Re: h:commandButton/a4j:commandButton does Page Refresh ???
Date Wed, 18 Jul 2007 17:04:47 GMT
Performance problems are hard to diagnose, because so much can cause them.

Remember, that to re-render the page, A4J needs to decode the entire
page, and (I think) re-render the entire page. It takes "chunks" out
of the response and sends those down.

Performance will be improved by using ajaxSingle="true" on the
support, and/or using a4j:region around the area to send. This will
reduce the decode/validation/update phases.

Then if you use [limitToList="true"] on the support, you will make
sure that only the items in the reRender attribute get re-rendered,
which will improve rendering performance.

None of this matters too much if your EL expressions on your
components are slow. In your case, if updateDeviceBean is a request
scope bean, and you have code in the "updateDeviceBean.tableRows" to
lazy load the data, then you will get this hit every page and AJAX
request.

What scope is your updateDeviceBean?

-Andrew

On 7/17/07, bansi <mail2bansi@yahoo.com> wrote:
>
> Hi Andrew
> This time i am getting perfomnace problem on click of radio button. Here is
> the snippet
> <div style="overflow:auto; width:85%; height:125px">
>             <h:dataTable id="deviceDetailTable"  styleClass="list"
> rowClasses="odd,even"
>                          value="#{updateDeviceBean.tableRows}" var="vartableRow"
>                          >
>     <a4j:region>
>                  <h:column id="column1">
>
>                                 <t:selectOneRadio id="interfaceId"
> value="#{updateDeviceBean.deviceInterface.id}" forceId="true"
> forceIdIndex="false">
>                                                    <f:selectItem itemLabel="" itemValue="#{vartableRow.id}"
/>
>                                                    <a4j:support
> action="#{updateDeviceBean.loadDeviceInterfaceDetails}" event="onclick"
> reRender="mac" />
>                                 </t:selectOneRadio>
>                                 <h:message for="interfaceId" />
>
>                         </h:column>
>                  </a4j:region>
> <h:column/>
> <h:column/>
>
> </h:dataTable>
> </div>
>
>
> <a4j:outputPanel>
>                            <h:panelGrid columns="3" styleClass="detail" columnClasses="label">
>
>
>                                                             <h:outputLabel><h:outputText
 value="MAC" />
> </h:outputLabel>
>                                                                         <h:inputText
 id="mac"
> value="#{updateDeviceBean.deviceInterface.mac}" />
>                                                             <h:message for="mac" />
>
> </h:panelGrid>
> </a4j:outputPanel>
>
>
> Andrew Robinson-5 wrote:
> >
> > Can you show the managed bean code?
> >
> > On 7/16/07, bansi <mail2bansi@yahoo.com> wrote:
> >>
> >> Andrew
> >> Thanks for quick response. As suggested i tried
> >>  <a4j:outputPanel  id="searchpanel" >
> >>    <h:panelGroup rendered="#{searchDeviceBean.searchResultSet}">
> >>
> >> Still it behaves the same way i.e. displays the search Results Set only
> >> after 3 clicks on search button
> >>
> >>
> >>
> >> Andrew Robinson-5 wrote:
> >> >
> >> > I bet it is because your outputPanel is not rendered the first time.
> >> > A4J needs to have a client HTML element present to replace the
> >> > contents of. In your example, the "searchpanel" may not be rendered,
> >> > and if so, there is nothing to replace on the client. A component that
> >> > is reRendered must first be rendered. Try this instead:
> >> >
> >> > <a4j:outputPanel id="searchpanel">
> >> >   <h:panelGroup rendered="#{searchDeviceBean.searchResultSet}">
> >> >   ...
> >> >   </h:panelGroup>
> >> > </a4j:outputPanel>
> >> >
> >> > On 7/16/07, bansi <mail2bansi@yahoo.com> wrote:
> >> >>
> >> >> Thanks Andrew i fixed it. I have similar kind of problem in different
> >> >> situation
> >> >>
> >> >> Their is a Search Form . Click on Search button reRenders the
> >> h:dataTable
> >> >> to
> >> >> display the search resultSet  but this happens  only after clicking
> >> the
> >> >> Search button twice or thrice. Quite wierd
> >> >>
> >> >> I tried doing the same fix but it didnt work i.e.
> >> >> <a4j:region>
> >> >> <h:commandButton id="search" value="Search"  styleClass="button"
>
> >> >>                 <a4j:support event="onclick"
> >> >> action="#{searchDeviceBean.search}"
> >> >> reRender="searchpanel" ajaxSingle="true"/>
> >> >>          </h:commandButton>
> >> >> </a4j:region>
> >> >>
> >> >> <a4j:outputPanel  id="searchpanel"
> >> >> rendered="#{searchDeviceBean.searchResultSet}">
> >> >>     <h:dataTable id="searchResults"
> >> >> value="#{searchDeviceBean.queryResults}"
> >> >> var="resultSet"    styleClass="list"  rowClasses="odd,even" >
> >> >>
> >> >>                 <h:column/>
> >> >> </h:dataTable>
> >> >>
> >> >>    </a4j:outputPanel>
> >> >>
> >> >> Any pointers/suggestions will be highly appreciated
> >> >>
> >> >>
> >> >>
> >> >>
> >> >> Andrew Robinson-5 wrote:
> >> >> >
> >> >> > Are you submitting values for those components? If so, the submitted
> >> >> > value will be rendered, not the value from the back-end.
> >> >> >
> >> >> > Try this:
> >> >> > <a4j:region>
> >> >> > <h:inputText  id="propertyTag" value="#{deviceBean.tagNumber}"
>
> >> >> > <a4j:support  action="#{dostuff}" event="onblur"
> >> >> >   reRender="mypanel" ajaxSingle="true"  />
> >> >> > </h:inputText>
> >> >> > </a4j:region>
> >> >> > <a4j:outputPanel id="mypanel">
> >> >> > ...
> >> >> > </a4j:outputPanel>
> >> >> >
> >> >> > What this will do is only decode/validate/update the inputText
> >> >> > component. Then, the other components in the reRender will not
have
> >> a
> >> >> > submittedValue or a local value and thus will render the value
from
> >> >> > the backing bean instead of the value from the client.
> >> >> >
> >> >> > There was another thread recently talking about similar issues
an
> >> how
> >> >> > to clear submitted values and local values. I don't have the URL
for
> >> >> > that one though.
> >> >> >
> >> >> > Hope I understood you correctly,
> >> >> > Andrew
> >> >> >
> >> >> > On 7/6/07, bansi <mail2bansi@yahoo.com> wrote:
> >> >> >>
> >> >> >> Andrew,
> >> >> >> Thanks for quick response. I will definately use the PhaseListener
> >> to
> >> >> >> debug
> >> >> >> the problem as you mentioned . Meanwhile i was thinking maybe
i
> >> >> >> misrepresented the problem .
> >> >> >> Here is the situation
> >> >> >> I have textfield with a4j onblur event
> >> >> >> As i tab out it reRenders other fields on the form . But while
> >> >> >> reRendering
> >> >> >> dropdown fields, it picks one element after the other in that
> >> dropdown
> >> >> ,
> >> >> >> i
> >> >> >> could see this on the page dropdown showing one element after
the
> >> >> other.
> >> >> >> And
> >> >> >> then cursor goes in wait mode for a while. Finally i get the
> >> correct
> >> >> >> results
> >> >> >>
> >> >> >> I understand the  reason to this behaviour. As these dropdowns
> >> appear
> >> >> >> later
> >> >> >> in the page, JSF tries render them as part of rendering the
page.
> >> But
> >> >> i
> >> >> >> have
> >> >> >> already rendered them using ajax onblur event. As i couldn't
do
> >> much
> >> >> in
> >> >> >> the
> >> >> >> JSF page , So in the backing bean i am generating the dropdown
only
> >> if
> >> >> >> its
> >> >> >> null. It still didnt help.I have posted the snippets in the
post
> >> >> >>
> >> >>
> >> http://www.nabble.com/Performance-issue-%3A-Setting-Dropdown-value-from-onblur-event-tf4037597.html.
> >> >> >>
> >> >> >> As i am sure i am making some small mistake somewhere like
in this
> >> >> post,
> >> >> >> i
> >> >> >> would appreciate your time in taking a look at the code snippets
in
> >> >> other
> >> >> >> post
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >> Andrew Robinson-5 wrote:
> >> >> >> >
> >> >> >> > It is extremely hard to comment on that post, as performance
> >> issues
> >> >> >> > can be anywhere in the code, especially since you are
hitting the
> >> >> >> > database. What I like to do, is create a debugging phase
listener
> >> >> that
> >> >> >> > prints out the current phase and then times the phase
by adding
> >> the
> >> >> >> > start time in the start of the phase into the request
map and
> >> then
> >> >> >> > performing a time difference in the end phase method.
That way
> >> you
> >> >> can
> >> >> >> > see what phase is slowing you down.
> >> >> >> >
> >> >> >> > Also, I have witnessed IE6 extremely slow to re-render
SELECT
> >> boxes
> >> >> >> > for some unknown reason. It may be because of the fact
that IE6
> >> uses
> >> >> >> > an MFC control, but not sure. Your best bet is to use
the above
> >> >> >> > technique, a debugger and step through the code, an client
side
> >> >> >> > debugger (like firebug for firefox) to time the javascript
or use
> >> a
> >> >> >> > performance tool.
> >> >> >> >
> >> >> >> > On 7/6/07, bansi <mail2bansi@yahoo.com> wrote:
> >> >> >> >>
> >> >> >> >> Thanks Andrew for the catch it works like charm now.
I will
> >> >> appreciate
> >> >> >> >> your
> >> >> >> >> time in taking a look at my other post :
> >> >> >> >>
> >> >> >>
> >> >>
> >> http://www.nabble.com/Performance-issue-%3A-Setting-Dropdown-value-from-onblur-event-tf4037597.html.
> >> >> >> >>
> >> >> >> >>
> >> >> >> >>
> >> >> >> >> Andrew Robinson-5 wrote:
> >> >> >> >> >
> >> >> >> >> > Make sure you have the list boxes in the reRender
property of
> >> the
> >> >> >> a4j
> >> >> >> >> > command button
> >> >> >> >> >
> >> >> >> >> > On 7/6/07, bansi <mail2bansi@yahoo.com>
wrote:
> >> >> >> >> >>
> >> >> >> >> >> I have observed a4j:commandButton works
only on Page Refresh
> >> >> >> >> >>
> >> >> >> >> >> Here is the situation
> >> >> >> >> >>
> >> >> >> >> >> I am using two h:selectManyListbox to moves
Roles i.e. All
> >> Roles
> >> >> to
> >> >> >> >> >> selected
> >> >> >> >> >> Roles using <h:commandButton value="-->"
/>
> >> >> >> >> >>
> >> >> >> >> >> h:commandButton works perfectly fine , the
only limitation is
> >> >> after
> >> >> >> >> >> moving
> >> >> >> >> >> the value from left to right Listbox, whole
page is
> >> >> automatically
> >> >> >> >> >> refreshed
> >> >> >> >> >> & the cursor moves to the top of the
page
> >> >> >> >> >>
> >> >> >> >> >> This is where we thought ajax4jsf would
come in handy &
> >> started
> >> >> >> using
> >> >> >> >> >> a4j:commandButton instead of h:commandButton.
> >> >> >> >> >> The result is when we click the a4j:commandButton
it doesnt
> >> >> moves
> >> >> >> the
> >> >> >> >> >> value
> >> >> >> >> >> from left to right Listbox. Then we did
page refreshed then
> >> only
> >> >> >> the
> >> >> >> >> >> value
> >> >> >> >> >> moved from left to right ListBox. Quite
Amazing !!!. This is
> >> >> >> totally
> >> >> >> >> >> opposite to behaviour of ajax
> >> >> >> >> >>
> >> >> >> >> >> We want a4j:commandButton to move the values
from left to
> >> right
> >> >> >> >> ListBox
> >> >> >> >> >> without page refresh . Any pointers/suggestions
will be
> >> highly
> >> >> >> >> >> appreciated
> >> >> >> >> >>
> >> >> >> >> >>
> >> >> >> >> >> --
> >> >> >> >> >> View this message in context:
> >> >> >> >> >>
> >> >> >> >>
> >> >> >>
> >> >>
> >> http://www.nabble.com/h%3AcommandButton-a4j%3AcommandButton-does-Page-Refresh-----tf4037659.html#a11471154
> >> >> >> >> >> Sent from the MyFaces - Users mailing list
archive at
> >> >> Nabble.com.
> >> >> >> >> >>
> >> >> >> >> >>
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >>
> >> >> >> >> --
> >> >> >> >> View this message in context:
> >> >> >> >>
> >> >> >>
> >> >>
> >> http://www.nabble.com/h%3AcommandButton-a4j%3AcommandButton-does-Page-Refresh-----tf4037659.html#a11472288
> >> >> >> >> Sent from the MyFaces - Users mailing list archive
at
> >> Nabble.com.
> >> >> >> >>
> >> >> >> >>
> >> >> >> >
> >> >> >> >
> >> >> >>
> >> >> >> --
> >> >> >> View this message in context:
> >> >> >>
> >> >>
> >> http://www.nabble.com/h%3AcommandButton-a4j%3AcommandButton-does-Page-Refresh-----tf4037659.html#a11472824
> >> >> >> Sent from the MyFaces - Users mailing list archive at Nabble.com.
> >> >> >>
> >> >> >>
> >> >> >
> >> >> >
> >> >>
> >> >> --
> >> >> View this message in context:
> >> >>
> >> http://www.nabble.com/h%3AcommandButton-a4j%3AcommandButton-does-Page-Refresh-----tf4037659.html#a11631547
> >> >> Sent from the MyFaces - Users mailing list archive at Nabble.com.
> >> >>
> >> >>
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >> http://www.nabble.com/h%3AcommandButton-a4j%3AcommandButton-does-Page-Refresh-----tf4037659.html#a11631845
> >> Sent from the MyFaces - Users mailing list archive at Nabble.com.
> >>
> >>
> >
> >
>
> --
> View this message in context: http://www.nabble.com/h%3AcommandButton-a4j%3AcommandButton-does-Page-Refresh-----tf4037659.html#a11658986
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>

Mime
View raw message