i write a simple visualforce page
<apex:page controller="Sample1">
<!-- Begin Default Content REMOVE THIS -->
<h1>Congratulations</h1>
This is your new Page
<apex:outputText id="outText"value="Hello World" rendered= "{! xx}"/>
<apex:form>
<apex:commandButton value="Click" action="{!changeValue}" rerender="outText"/>
</apex:form>
<!-- End Default Content REMOVE THIS -->
</apex:page>
and controller code is
public class Sample1{
public Boolean xx{get;set;}
public Sample1(){
xx=true;
}
public PageReference changeValue(){
xx=false;
return null;
}
}
but when i click the button nothing happens Hello World still renders.Please explain why rerender is not working ??
Best Answer
The element that you re-render seems to have to be a container of the outputText; this works:
The "Bob Buzzard Blog" post Visualforce Re-rendering Woes suggests the reasoning behing this design: