You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by bansi <ma...@yahoo.com> on 2007/07/06 21:28:25 UTC

h:commandButton/a4j:commandButton does Page Refresh ???

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="--&gt;" />

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.


Re: h:commandButton/a4j:commandButton does Page Refresh ???

Posted by bansi <ma...@yahoo.com>.
Andrew
I figured out the problem was enclosing <a4j:region> tag for Search Button.
i.e. if we have a4j:region tag then click of search button is not submitting
the search input textfield value to the form & hence the query use to return
no records
When i remove the a4j:region tag , the query returns the records but still
it behaves the same way i.e. it doesnt display search results on first click
of 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 <ma...@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 <ma...@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 <ma...@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 <ma...@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#a11640481
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: h:commandButton/a4j:commandButton does Page Refresh ???

Posted by bansi <ma...@yahoo.com>.
The scope of updateDeviceBean is "Session" bean 

Andrew Robinson-5 wrote:
> 
> 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 <ma...@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 <ma...@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 <ma...@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 <ma...@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 <ma...@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 <ma...@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.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/h%3AcommandButton-a4j%3AcommandButton-does-Page-Refresh-----tf4037659.html#a11675984
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: h:commandButton/a4j:commandButton does Page Refresh ???

Posted by Andrew Robinson <an...@gmail.com>.
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 <ma...@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 <ma...@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 <ma...@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 <ma...@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 <ma...@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 <ma...@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.
>
>

Re: h:commandButton/a4j:commandButton does Page Refresh ???

Posted by bansi <ma...@yahoo.com>.
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 <ma...@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 <ma...@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 <ma...@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 <ma...@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 <ma...@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.


Re: h:commandButton/a4j:commandButton does Page Refresh ???

Posted by bansi <ma...@yahoo.com>.
Andrew
Thank you so much it works now.  Here is the snippet
<a4j:region>
	 <h:commandButton id="search" value="Search"   styleClass="button"
action="#{searchDeviceBean.search}" reRender="searchResults" />
	 </a4j:region>
Its quite wierd though why it didnt worked yesterday
Now it reRenders h:dataTable on first click & only if records found. How to
check the condition to display "No records Found". Di i need to use JSTL tag
. Is it possible to check the list size using JSTL tag



Andrew Robinson-5 wrote:
> 
> Can you show the managed bean code?
> 
> On 7/16/07, bansi <ma...@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 <ma...@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 <ma...@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 <ma...@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 <ma...@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#a11654717
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: h:commandButton/a4j:commandButton does Page Refresh ???

Posted by bansi <ma...@yahoo.com>.
Andrew

Here is the snippet from managed bean
public List getQueryResults(){		
		System.out.println(" *** In getQueryResults Backing Bean*** searchList
size="+searchList.size());	
			return searchList;
	}
The above method returns searchList size = 1 . When i click Search button
twice or thrice i can see the searchList size changing to 2 & 3. 

I have also several debugging statements in managed bean code which prints
expected results. Yesterday i tried changing it to a4j:commandButton & it
worked fine. Today morning to much of my suprise it got back to its old
behaviour
Here is the changed snippet ( i removed a4j:region around a4j:commandButton)

<a4j:commandButton id="search" value="Search" styleClass="button"
action="#{searchDeviceBean.search}" reRender="searchResults" />

<a4j:outputPanel id="searchpanel" >
<h:dataTable id="searchResults" value="#{searchDeviceBean.queryResults}"
var="resultSet" styleClass="list" rowClasses="odd,even"
rendered="#{searchDeviceBean.searchResultSet}">

<h:column/>
<h:column/>
<h:column/>

</h:dataTable>

</a4j:outputPanel> 

Andrew Robinson-5 wrote:
> 
> Can you show the managed bean code?
> 
> On 7/16/07, bansi <ma...@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 <ma...@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 <ma...@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 <ma...@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 <ma...@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#a11653789
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: h:commandButton/a4j:commandButton does Page Refresh ???

Posted by Andrew Robinson <an...@gmail.com>.
Can you show the managed bean code?

On 7/16/07, bansi <ma...@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 <ma...@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 <ma...@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 <ma...@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 <ma...@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.
>
>

Re: h:commandButton/a4j:commandButton does Page Refresh ???

Posted by bansi <ma...@yahoo.com>.
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 <ma...@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 <ma...@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 <ma...@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 <ma...@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.


Re: h:commandButton/a4j:commandButton does Page Refresh ???

Posted by Andrew Robinson <an...@gmail.com>.
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 <ma...@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 <ma...@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 <ma...@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 <ma...@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.
>
>

Re: h:commandButton/a4j:commandButton does Page Refresh ???

Posted by bansi <ma...@yahoo.com>.
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 <ma...@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 <ma...@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 <ma...@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.


Re: h:commandButton/a4j:commandButton does Page Refresh ???

Posted by bansi <ma...@yahoo.com>.
Andrew,
I tried your code snippet but it results in  the action method of onblur
event method i.e. action="#{dostuff}"  at the first call to load the object
. actually the error occurs in business layer where i am converting String
value to Long using Long.valueOf() where it throws NumberFormatException. My
pojo has the id defined as Long and it works perfect in all cases . So i
reverted the code & it  worked again

[Quote]
Are you submitting values for those components? If so, the submitted
value will be rendered, not the value from the back-end.
[/Quote]

For the first time when the  form loads, the dropdowns are populated from
database . This is happyPath :)-
When user starts interacting with the form i.e. key in data into textfield
and tabs out , as expected other fields on the form  have their values set
based on input data in  textbox thru database query. BUT if one of this
fields happens to be dropdown then latency occurs as it getting "reRendered"
(as told in a4j onblur event) i.e. tries to set the value based on input
data in textbox.

But this reRendering is happening in a round-about way i.e.
it iterates  thru each & every element in the list like while loop and then
sets the correct value in the dropdown. 
Other dropdowns too have similar behaviour . Please note in  backing bean i
am populating the dropdown only if its null  .  For example 

public List getBuildingList(){
		logger.info(" *** In getBuildingList() Backing Bean size= ");		
				
		if(buildingSelectItems == null )
			this.buildingSelectItems = doGetBuildingList();
		return buildingSelectItems;
	}

public List doGetBuildingList() {
		logger.info(" *** In doGetBuildingList() Backing Bean");
}



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 <ma...@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 <ma...@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 <ma...@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#a11473974
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: h:commandButton/a4j:commandButton does Page Refresh ???

Posted by Andrew Robinson <an...@gmail.com>.
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 <ma...@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 <ma...@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 <ma...@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.
>
>

Re: h:commandButton/a4j:commandButton does Page Refresh ???

Posted by bansi <ma...@yahoo.com>.
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 <ma...@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 <ma...@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.


Re: h:commandButton/a4j:commandButton does Page Refresh ???

Posted by Andrew Robinson <an...@gmail.com>.
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 <ma...@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 <ma...@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.
>
>

Re: h:commandButton/a4j:commandButton does Page Refresh ???

Posted by bansi <ma...@yahoo.com>.
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 <ma...@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.


Re: h:commandButton/a4j:commandButton does Page Refresh ???

Posted by Andrew Robinson <an...@gmail.com>.
Make sure you have the list boxes in the reRender property of the a4j
command button

On 7/6/07, bansi <ma...@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.
>
>