JSF - Unhide jsf component when clicking another component.

Posted by Ben on Stack Overflow See other posts from Stack Overflow or by Ben
Published on 2010-05-24T10:32:58Z Indexed on 2010/05/24 11:01 UTC
Read the original article Hit count: 890

Filed under:
|
|

Hi,

I'm trying to have a button that brings up an upload dialog. The way i'm trying to achieve this is similar to this:

<h:outputText value="Click Me" id="testit">
  <a4j:support reRender="hideme" event="onclick" action="#{actions.switchTestRendered}"/>
</h:outputText>
<h:outputText id="hideme" value="back" rendered="#{actions.testRendered}"/>

With code in the backing bean:

private boolean testRendered = false;
public String switchTestRendered(){
 setTestRendered(!isTestRendered());
 System.out.println("Current Status:"+isTestRendered());
 return "success";
}

public void setTestRendered(boolean testRendered) {
  this.testRendered = testRendered;
}

public boolean isTestRendered() {
  return testRendered;
}

When I press the 'click me' label I can see that the switchTestRendered is run but the 'hideme' component does not reveal.

Any suggestions? Thanks!

© Stack Overflow or respective owner

Related posts about jsf

Related posts about a4j