I have the following snippet:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<f:metadata>
<f:event type="preRenderView" listener="#{workflowController.test}"/>
</f:metadata>
<h:head>
<title>Simple JSF Facelets page</title>
</h:head>
<h:body>
Hello, Place your content here
</h:body>
</html>
When I open the page, the WorkflowController.test() method is called twice (it's just a simple method which makes a log entry). Do you know why it's being called twice?
Thanks.
Try to put the <f:event/>
tag outside of the <f:metadata>
, it worked for me (mojarra 2.1.0).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With