prerenderView system event callback only triggered in certain cases
-------------------------------------------------------------------

                 Key: MYFACES-3004
                 URL: https://issues.apache.org/jira/browse/MYFACES-3004
             Project: MyFaces Core
          Issue Type: Bug
    Affects Versions: 2.0.3, 2.0.2
         Environment: all, server
            Reporter: Werner Punz


Following scenario, two pages with implicit navigation. A prerender view system 
event handler set over 
  <h:head>
        <title>Facelet Title</title>
        <f:metadata>
            <f:event listener="#{pageHandler.prerender}" type="preRenderView" />
        </f:metadata>
    </h:head>

Now the prerender event is called:
a) if I go via http get into the page
b) If I execute actions which stay on the page

The event handler however is not called
if I navigate into the page via an implicit (maybe also explicit) navigation 
case.

A quick test revealed that the event handler is called in three cases in 
mojarra and I assume our behavior is faulty
and the behavior from mojarra is the one compliant to the spec.
I am setting the priority to major because the prerenderview event is very 
important in certain app classes which use callbacks to this event
to deal with auto display mechanisms and with data loading in certain app 
states.



Here is the complete example:

page1:
<?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";>
    <h:head>
        <title>Facelet Title</title>
        <f:metadata>
            <f:event listener="#{pageHandler.prerender}" type="preRenderView" />
        </f:metadata>
    </h:head>
    <h:body>
        <h:form>
        Hello from Facelets
        <h:commandLink action="page2" value="page2"/>

        </h:form>
    </h:body>
</html>


page2:
<?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";>
    <h:head>
        <title>Facelet Title</title>
    </h:head>
    <h:body>
        <h:form>
            Hello from Facelets
            <h:commandLink action="page1" value="go to page 1" />
        </h:form>
    </h:body>
</html>



and the corresponding bean:
@ManagedBean
@RequestScoped
public class PageHandler {

    public void prerender() {
        System.out.println("Prerender View");
    }

}


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to