0

I want to display a div, if a boolean is false.

This is my Bean:

@Named
@RequestScoped
public class NewUserBean implements Serializable {
    private static final long serialVersionUID = 1L;

    private boolean bool = false;

public boolean isBool() {
    return bool;
}


public void setBool(boolean bool) {
    this.bool = bool;
}

And this is a part of my .xhtml File

<div jsf:rendered="#{!newUserBean.bool}">

//Display something
</div>

The view displays nothing, but if I change it 2

<div jsf:rendered="#{newUserBean.bool}">

the View displays the div-element although the boolean is false.

My HTML div-element mets all conditions (1. There's at least one jsf:xxx attribute from http://xmlns.jcp.org/jsf namespace. 2.There's at least one "identifying attribute" associated with a specific JSF component. ) to become a passthrough-element. However it doesn´t work.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Mirror
  • 1
  • 1
  • Could that be because your bool value is false? Did you try to set it to true? – kosa Mar 09 '16 at 20:18
  • As per your edit, if you can assure that you properly declared `xmlns:jsf` namespace in your page, then this can only mean that you're either not using JSF 2.2 (but an older version), or that the request URL didn't match URL-pattern of `FacesServlet` defined in `web.xml`. In that case, this duplicate is then more suitable: http://stackoverflow.com/q/3112946 – BalusC Mar 09 '16 at 20:50
  • i changed the URL-pattern to *.xhtml and i use JSF 2.2. But unfortunately it doesn´t run. I declared the xmlns: jsf : xmlns:jsf="http://xmlns.jcp.org/jsf". Sorry :-/ – Mirror Mar 09 '16 at 21:37
  • Which JSF impl/version? This works just for me using the most recent Mojarra 2.2.13. – BalusC Mar 09 '16 at 21:43
  • I use JSF 2.2 with Jboss-Tools on Wildfly 10 (on Eclipse) – Mirror Mar 09 '16 at 22:26

0 Answers0