Press enter to see results or esc to cancel.


JSF Error Failed to parse the expression [#{navController.go_to_index()}]

JSF Page load Error

javax.faces.view.facelets.TagAttributeException: /tab.xhtml @12,84 action="#{navController.go_to_index()}" Failed to parse the expression [#{navController.go_to_index()}]
  1. An error comes on running code as shown below.
    <html xmlns="http://www.w3.org/1999/xhtml"
     xmlns:h="http://xmlns.jcp.org/jsf/html">
     <h:head>
     <title>Facelet Title</title>
     </h:head>
     <h:body>
     <h:form>
     <h:commandButton value="Index" action="#{navController.go_to_index()}"></h:commandButton>
     <h:commandButton value="About Us" action="#{navController.go_to_about()}"></h:commandButton>
     <h:commandButton value="Contact Us" action="#{navController.go_to_contact()}"></h:commandButton>
     </h:form>
     </h:body>
    </html>
    
  2. Solution.
    Remove the Braces () of the call function.

     <h:form>
     <h:commandButton value="Index" action="#{navController.go_to_index}"></h:commandButton>
     <h:commandButton value="About Us" action="#{navController.go_to_about}"></h:commandButton>
     <h:commandButton value="Contact Us" action="#{navController.go_to_contact}"></h:commandButton>
     </h:form>