Target Unreachable, Identifier resolved to null

Asked

Viewed 1,051 times

0

When I try to open the page, I get:

javax.el.PropertyNotFoundException: pagina.xhtml @3,54 value="#{meuManagedBean.valores}": Target Unreachable, identifier 'meuManagedBean' resolved to null

Considering:

<h:form>
    <p:outputLabel id="formulario" value="#{meuManagedBean.label}"/>
    <p:selectOneRadio id="grupo" layout="custom" value="#{meuManagedBean.valores}">
        <f:selectItem itemLabel="Verdadeiro" itemValue="true"/>
        <f:selectItem itemLabel="Falso" itemvalue="false"/>
        <p:ajax event="keyup" update="formulario"/>
    </p:selectOneRadio>
    <p:panelGrid columns="4">
        <p:radioButton for="grupo" itemIndex="0"/>
        <p:outputLabel value="Verdadeiro"/>
        <p:radioButton for="grupo" itemIndex="1"/>
        <p:outputLabel value="Falso"/>
    </p:panelGrid>
</h:form>

Why the mistake is only in the EL of p:selectOneRadio and not of p:outputLabel? How to solve?

1 answer

1

This mistake happens because the meuManagedBean simply doesn’t exist in this case. Perhaps some annotation was missing in the class to indicate that this class must be a manageable bean or simply the bean name is wrong. The names of Beans are case-sensitive, that is, there is difference between a bean called MeuManagedBean and another call meuManagedBean.

About the error being fired only on selectOneMenu, this depends a lot on the implementation of the JSF you are using (Mojarra, Myfaces), because each acts differently, but what happens is that the XHTML is transformed into a component tree, and for some reason this entry is being executed before the outputLabel. For test purposes, just leave the label in the XHTML. You will get the same result as there will only be one to run.

  • I am using Mojarra. I left only the outputLabel EL and it worked. The meuManagedBean is with the appropriate annotations and the name is also correct. There is some special implication as it is a selectOneMenu?

  • @Patrick Is the list void? She has to be instantiated.

  • I’m afraid not, because he’s a boolean (Boolean valores;).

  • @Patrick I believe the right kind of dice to be used with a selectOneRadio no value is a String, not a Boolean, as the Primefaces example in the showcase shows: http://www.primefaces.org/showcase/ui/input/oneRadio.xhtml

  • Does this influence something? Because I want when "true" is selected to be true, when "false" is false.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.