Like as all other on*
attributes on all JSF components, the onidle
attribute must represent a JavaScript callback, not a JSF backing bean action method. Any EL expressions in on*
attributes would be evaluated immediately as String
value expressions during generating the HTML output in expectation that they print (part of) JavaScript code.
It's exactly like as if you're doing <h:outputText value="#{mybean.processTimeout()}">
. If you had removed the parentheses ()
, you'd have faced a PropertyNotFoundException
which was also a hint at its own of it being evaluated as a value expression instead of a method expression.
In order to invoke a JSF backing bean method using JavaScript, you need an additional <p:remoteCommand>
.
<p:idleMonitor onidle="processTimeout()" timeout="180000" />
<p:remoteCommand name="processTimeout" action="#{mybean.processTimeOut}" />
If you're not on PrimeFaces, head to the alternatives posted in this related answer: How to invoke a JSF managed bean on a HTML DOM event using native JavaScript?