myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bansi <mail2ba...@yahoo.com>
Subject Re: h:commandButton/a4j:commandButton does Page Refresh ???
Date Fri, 06 Jul 2007 23:28:47 GMT

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 <mail2bansi@yahoo.com> wrote:
>>
>> Andrew,
>> Thanks for quick response. I will definately use the PhaseListener to
>> debug
>> the problem as you mentioned . Meanwhile i was thinking maybe i
>> misrepresented the problem .
>> Here is the situation
>> I have textfield with a4j onblur event
>> As i tab out it reRenders other fields on the form . But while
>> reRendering
>> dropdown fields, it picks one element after the other in that dropdown ,
>> i
>> could see this on the page dropdown showing one element after the other.
>> And
>> then cursor goes in wait mode for a while. Finally i get the correct
>> results
>>
>> I understand the  reason to this behaviour. As these dropdowns appear
>> later
>> in the page, JSF tries render them as part of rendering the page. But i
>> have
>> already rendered them using ajax onblur event. As i couldn't do much in
>> the
>> JSF page , So in the backing bean i am generating the dropdown only if
>> its
>> null. It still didnt help.I have posted the snippets in the post
>> http://www.nabble.com/Performance-issue-%3A-Setting-Dropdown-value-from-onblur-event-tf4037597.html.
>>
>> As i am sure i am making some small mistake somewhere like in this post,
>> i
>> would appreciate your time in taking a look at the code snippets in other
>> post
>>
>>
>>
>> Andrew Robinson-5 wrote:
>> >
>> > It is extremely hard to comment on that post, as performance issues
>> > can be anywhere in the code, especially since you are hitting the
>> > database. What I like to do, is create a debugging phase listener that
>> > prints out the current phase and then times the phase by adding the
>> > start time in the start of the phase into the request map and then
>> > performing a time difference in the end phase method. That way you can
>> > see what phase is slowing you down.
>> >
>> > Also, I have witnessed IE6 extremely slow to re-render SELECT boxes
>> > for some unknown reason. It may be because of the fact that IE6 uses
>> > an MFC control, but not sure. Your best bet is to use the above
>> > technique, a debugger and step through the code, an client side
>> > debugger (like firebug for firefox) to time the javascript or use a
>> > performance tool.
>> >
>> > On 7/6/07, bansi <mail2bansi@yahoo.com> wrote:
>> >>
>> >> Thanks Andrew for the catch it works like charm now. I will appreciate
>> >> your
>> >> time in taking a look at my other post :
>> >>
>> http://www.nabble.com/Performance-issue-%3A-Setting-Dropdown-value-from-onblur-event-tf4037597.html.
>> >>
>> >>
>> >>
>> >> Andrew Robinson-5 wrote:
>> >> >
>> >> > Make sure you have the list boxes in the reRender property of the
>> a4j
>> >> > command button
>> >> >
>> >> > On 7/6/07, bansi <mail2bansi@yahoo.com> wrote:
>> >> >>
>> >> >> I have observed a4j:commandButton works only on Page Refresh
>> >> >>
>> >> >> Here is the situation
>> >> >>
>> >> >> I am using two h:selectManyListbox to moves Roles i.e. All Roles
to
>> >> >> selected
>> >> >> Roles using <h:commandButton value="-->" />
>> >> >>
>> >> >> h:commandButton works perfectly fine , the only limitation is after
>> >> >> moving
>> >> >> the value from left to right Listbox, whole page is automatically
>> >> >> refreshed
>> >> >> & the cursor moves to the top of the page
>> >> >>
>> >> >> This is where we thought ajax4jsf would come in handy & started
>> using
>> >> >> a4j:commandButton instead of h:commandButton.
>> >> >> The result is when we click the a4j:commandButton it doesnt moves
>> the
>> >> >> value
>> >> >> from left to right Listbox. Then we did page refreshed then only
>> the
>> >> >> value
>> >> >> moved from left to right ListBox. Quite Amazing !!!. This is
>> totally
>> >> >> opposite to behaviour of ajax
>> >> >>
>> >> >> We want a4j:commandButton to move the values from left to right
>> >> ListBox
>> >> >> without page refresh . Any pointers/suggestions will be highly
>> >> >> appreciated
>> >> >>
>> >> >>
>> >> >> --
>> >> >> View this message in context:
>> >> >>
>> >>
>> http://www.nabble.com/h%3AcommandButton-a4j%3AcommandButton-does-Page-Refresh-----tf4037659.html#a11471154
>> >> >> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/h%3AcommandButton-a4j%3AcommandButton-does-Page-Refresh-----tf4037659.html#a11472288
>> >> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>> >>
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/h%3AcommandButton-a4j%3AcommandButton-does-Page-Refresh-----tf4037659.html#a11472824
>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>
>>
> 
> 

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


Mime
View raw message