myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Kitching <simon.kitch...@chello.at>
Subject Re: browser page refresh (F5) displays wrong values quite often
Date Tue, 06 Nov 2007 09:12:14 GMT
Hi Mario,

Have you tried using "shift-f5"?

Some browsers implement refresh internally, ie redisplay the contents of their cache rather
than sending a request back to the server.

I suspect that is what is happening to you: the browser is trying to be smart and serving
its cached data to you for an internally-hardwired number of refreshes (8 in this case), then
deciding you *really* want to refresh and fetching from the server.

I think shift-f5 traditionally forces a reload from the remote server rather than serving
from the cache.

If this is the case, then you might want to look at what http headers you are sending with
your pages. There are headers available that order browsers to not use page caching etc.

If you are not using Firefox, then I can highly recommend using it and installing the "live
http headers" extension so that you can see exactly what requests/responses are being exchanged.

Regards,

Simon

---- mario_nabble <send_lotsa_spam_here@yahoo.com> schrieb:
> 
> Hi all,
> 
> This one really puzzles me. I have a page with a backing bean and 2 text
> input fields: a string and a float. Ajax4Jsf is sending down the changes,
> which happen all fine. Now, if I press F5 (refresh) for a few times, the
> displayed values will cycle between the old and the newly set values.
> Sometimes they are OK, sometimes old, the cycle repeats each 8 clicks on the
> refresh and the two values are not wrong at the same time (aka sometimes
> only one, sometimes both, but still repeatable).
> 
> I don't even know where to start... 
> 
> I just notice in the console that the getters for the properties are not
> always called - are missing precisely when the value is wrong. Below also a
> console snippet.
> 
> I use MyFaces 1.2.0, Tomahawk 1.1.6, Facelets 1.0.14, Richfaces 3.1.0,
> Eclipse 3.3 and Tomcat 5.5.whatever.
> Here is the code, I left out the headers and such:
> 
> index.xhtml
> 
>     <a4j:form id="wholePage">
>       <h:panelGrid
>         id="tarifZone"
>         columns="1"
>         border="0"
>         cellspacing="0"
>         cellpadding="0">
>         <t:column>
>           <mylib:myGroup />
>         </t:column>
>       </h:panelGrid>
>     </a4j:form>
> 
> myGroup.xhtml
> 
>   <ui:composition>
> 	<h:panelGrid id="myGroup" columns="2" border="1" cellspacing="0"
> 		cellpadding="10">
> 		<t:column>
> 			<t:outputText value="blah" />
> 		</t:column>
> 		<t:column>
> 			<t:outputText value="testfloat" />
> 		</t:column>
> 		<t:column>
> 			<t:inputText value="#{DataAccess.blah}"
> 				title="#{DataAccess.blah}">
> 				<a4j:support event="onchange" ajaxSingle="true" limitToList="true"
> 					reRender="myGroup" />
> 			</t:inputText>
> 		</t:column>
> 		<t:column>
> 			<t:inputText
> 				value="#{DataAccess.test}"
> 				title="testfloat"
> 				id="testfloat">
> 				<a4j:support event="onchange" ajaxSingle="true" limitToList="true"
> 					reRender="myGroup" />
> 			</t:inputText>
> 		</t:column>
> 	</h:panelGrid>
> 	<a4j:outputPanel ajaxRendered="true" style="color:red;">
> 		<h:messages></h:messages>
> 	</a4j:outputPanel>
> </ui:composition>
> 
> DataAccess.java:
> 
> public class DataAccess {
> 
>     private String blah = "1";
>     private Float test = 1.0F;
>     public String getBlah() {
>         System.out.println("---get blah: " + blah);
>         return blah;
>     }
>     public void setBlah(String val) {
>         System.out.println("---set blah: " + val);
>         this.blah = val;
>     }
>     public Float getTest() {
>         System.out.println("---get test: " + test);
>         return test;
>     }
>     public void setTest(Float val) {
>         System.out.println("---set test: " + val);
>         test=val;
>     }
> }
> 
> and console output, with a correct and a wrong refresh:
> 
> 05 Nov 2007 17:49:30,129 DEBUG javax.faces.webapp.FacesServlet - service
> begin
> BeforePhase: RESTORE_VIEW(1)
> AfterPhase: RESTORE_VIEW(1)
> BeforePhase: RENDER_RESPONSE(6)
> ---get blah: 1111
> ---get blah: 1111 <------------------------no getter for "test", wrong value
> displayed!!!!!!!!!!
> AfterPhase: RENDER_RESPONSE(6)
> 05 Nov 2007 17:49:30,144 DEBUG javax.faces.webapp.FacesServlet - service end
> 05 Nov 2007 17:49:39,036 DEBUG javax.faces.webapp.FacesServlet - service
> begin
> BeforePhase: RESTORE_VIEW(1)
> AfterPhase: RESTORE_VIEW(1)
> BeforePhase: RENDER_RESPONSE(6)
> ---get blah: 1111
> ---get blah: 1111
> ---get test: 2222.0 <------------------- getter called, correct value
> displayed
> AfterPhase: RENDER_RESPONSE(6)
> 05 Nov 2007 17:49:39,052 DEBUG javax.faces.webapp.FacesServlet - service end
> 
> 
> Thank you very very very much for hinting me what I'm doing wrong...
> Regards,
> M
> 
> -- 
> View this message in context: http://www.nabble.com/browser-page-refresh-%28F5%29-displays-wrong-values-quite-often-tf4753007.html#a13591145
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
> 


Mime
View raw message