PropertyNotFoundException when calling method with commandbutton

580 Views Asked by At

When I click commandbutton I get this error:

javax.el.PropertyNotFoundException: /registracija.xhtml @78,120 action="#{noviKorisnik.kreiraj()}": Target Unreachable, identifier 'noviKorisnik' resolved to null

<h:form>
    <h:commandButton value="Registriraj" action="#{noviKorisnik.kreiraj()}" />
</h:form>

Here is my java class

@ManagedBean
public class NoviKorisnik {
           ...
   public void kreiraj() { ... }
}

How can I solve this?

1

There are 1 best solutions below

0
On

The action attribute accepts a method-binding expression for a backing bean action method to invoke when this component is activated by the user. An action method must be a public method with no parameters that returns a String. The returned string represents the logical outcome of the action (eg. "success", "failure", etc. ) and is used by the JavaServer Faces MVC framework to determine which view to display next.