I have the following setup:
-
testBean.java with a method
public String getResult(), which returns"success" -
test.xhtml with
<h:commandLink action="#{testBean.result}" value="testlink" /> -
The following navigation rule inside faces-config.xml:
<navigation-rule> <from-view-id>/views/test.xhtml</from-view-id> <navigation-case> <from-outcome>success</from-outcome> <to-view-id>/views/nextpage.xhtml</to-view-id> <redirect /> </navigation-case>
I checked that the navigation works in general by simply putting “success” directly into the action attribute (works). Also, printing testBean.result as an outputText correctly displays “success”.
However, when clicking on the link I get an “Server Internal Error” and am only allowed to reload the page. The log shows a javax.el.MethodNotFoundException with the following text:
Method not found: com.company.project.view.TestBean@81de8.result()
I am confused as to where the mysterious @81de8 comes from. Is this the cause of the problem, just a symptom of some mismatch elsewhere or some perfectly normal behind-the-scenes magic? Can anybody figure out why the invocation inside a commandLink fails, when in an outputText it does not? Or point me to other things I should check and test?
Thanks in advance,
Louise
Edits: The Java Method is named getResult (not result) and the error code pointed towards the method result (not string). Those have been mistakes in writing up the question, caused by asking it at the end of a long day of work 😉 Sorry.
You’re not running the code you think you’re running.
You said that you’ve declared a
But the exception is telling you that the actually running code has a
Perhaps it’s a leftover from one of your previous attempts or you were opening the wrong page? Verify, clean, rebuild and redeploy and this problem should disappear.
It’s just the hashcode of the class’ instance. See also
Object#toString()javadoc. You’d see the same string format when you do