title: Why isn't Liferay Faces processing JSF portlet action events?
body: <p>I am having issues with trying to use Liferay Faces along with any JSF components to fire action events.</p>
  
  <p>I've gone through the first part of Liferay's <a href="https://www.liferay.com/documentation/liferay-portal/6.2/development/-/ai/develop-jsf-portlets-liferay-portal-6-2-dev-guide-en" rel="nofollow noreferrer">Developing JSF Portlets</a> instruction page up until (but not including) the Internationalize JSF Portlets section with success.  I went ahead and added some other JSF components with some success as well, however, events are not working.</p>
  
  <p>The goal of this example is to have a text box where the user can change the default text of "World", and a text area will update by AJAX on every keystroke with "Hello, XXX" (where XXX is the text from the box).  Yes, in a separate JSF project I have tried out the view.xhtml and TestBean.java and it works.</p>
  
  <p>In the Liferay portal, the portlet shows up and when I type I am getting a postback to the server.  The DebugPhaseListener is resulting in only BEFORE/AFTER RESTORE_VIEW 1, and BEFORE/AFTER RENDER_RESPONSE 6.  There are no phases in between, which I presume is indicative of the problem.  (Note: The Liferay Faces portlet bridge bridges the portlet lifecycle events and emulates the JSF lifecycle.)</p>
  
  <p>I am using Liferay 6.2, running in Eclipse Luna with Liferay's latest Tomcat bundle and latest eclipse plugin from the Liferay update site.  Java 1.7.0_71.</p>
  
  <p>Here are all of the assets and code that I think are relevant to figure out what is going on.  Any help you can give would be greatly appreciated.</p>
  
  <p>view.xhtml:</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  
  &lt;f:view
      xmlns="http://www.w3.org/1999/xhtml"
      xmlns:c="http://java.sun.com/jsp/jstl/core"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
  &gt;
      &lt;h:head /&gt;
      &lt;h:body&gt;
          &lt;h:form id="someForm"&gt;
              &lt;p:calendar id="myCal" mode="inline" value="#{testBean.myDate}" actionListener="#{testBean.updateDate}"&gt;
                  &lt;p:ajax actionListener="#{testBean.updateDate}" update="myMsgs"/&gt;
              &lt;/p:calendar&gt;
              &lt;br/&gt;
              &lt;p:commandButton value="Hi there" actionListener="#{testBean.updateDate}" update="myMsgs"/&gt;
              &lt;br/&gt;
              &lt;p:messages id="myMsgs"/&gt;
              &lt;br/&gt;
              Test String=#{testBean.testString}
              &lt;br/&gt;
              Output Text test string = &lt;h:outputText value="#{testBean.testString}"/&gt;
  
  
              &lt;h:outputLabel value="Name" for="nameInput" /&gt;
              &lt;h:inputText id="nameInput" value="#{testBean.name}"&gt;
                  &lt;f:ajax render="output" event="keyup" /&gt;
              &lt;/h:inputText&gt;
              &lt;br/&gt;
  
              &lt;p&gt;
                  &lt;h:panelGroup id="output"&gt;
                      &lt;strong&gt; &lt;h:outputText value="Hello, #{testBean.name}" /&gt;
                      &lt;/strong&gt;
                  &lt;/h:panelGroup&gt;
              &lt;/p&gt;
  
              &lt;h:commandButton id="reset" value="Reset"
                  actionListener="#{testBean.reset}"&gt;
                  &lt;f:ajax render="@form" /&gt;
              &lt;/h:commandButton&gt; - Reset The Form to "World"
              &lt;br/&gt;
  
              &lt;h:messages /&gt;
  
          &lt;/h:form&gt;
      &lt;/h:body&gt;
  &lt;/f:view&gt;
  </code></pre>
  
  <p>TestBean.java</p>
  
  <pre><code>import java.io.Serializable;
  import java.util.Date;
  
  import javax.annotation.PostConstruct;
  import javax.faces.bean.ManagedBean;
  import javax.faces.bean.SessionScoped;
  import javax.faces.event.ActionEvent;
  
  
  @ManagedBean(name="testBean")
  @SessionScoped
  public class TestBean
      implements Serializable
  {
      private static final long serialVersionUID = 1L;
  
      public String getTestString()
      {
          return "Test String";
      }
  
      private Date myDate = new Date();
      public Date getMyDate() { return myDate; }
      public void setMyDate(Date value) { System.out.println("setMyDate value="+value); myDate = value; }
  
      public void updateDate()
      {
          System.out.println("updateDate - myDate="+myDate);
      }
  
      /**
       * Stores the name which will be used to greet the application user.
       */
      private String name;
  
      /**
       * Initializes {@link #name} with the value {@code "World"}.
       */
      @PostConstruct
      public void postContruct()
      {
          this.name = "World";
      }
  
      /**
       * Returns {@link #name}.
       *
       * @return {@link #name}
       */
      public String getName()
      {
          return name;
      }
  
      /**
       * Set {@link #name}.
       *
       * @param value
       */
      public void setName(String value)
      {
          System.out.println("Setting name to " + value);
          name = value;
      }
  
      /**
       * Resets {@link #name} to the default value {@code "World"}.
       *
       * @param ae
       * ignored
       */
      public void reset(ActionEvent ae)
      {
          setName("World");
      }
  }
  </code></pre>
  
  <p>portlet.xml</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  
  &lt;portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" version="2.0"&gt;
  
      &lt;portlet&gt;
          &lt;portlet-name&gt;my-calendar-portlet&lt;/portlet-name&gt;
          &lt;display-name&gt;My Calendar Portlet&lt;/display-name&gt;
          &lt;portlet-class&gt;
              javax.portlet.faces.GenericFacesPortlet
          &lt;/portlet-class&gt;
          &lt;init-param&gt;
              &lt;name&gt;javax.portlet.faces.defaultViewId.view&lt;/name&gt;
              &lt;value&gt;/views/my-calendar-portlet/view.xhtml&lt;/value&gt;
          &lt;/init-param&gt;
          &lt;init-param&gt;
              &lt;name&gt;javax.portlet.faces.defaultViewId.edit&lt;/name&gt;
              &lt;value&gt;/views/my-calendar-portlet/edit.xhtml&lt;/value&gt;
          &lt;/init-param&gt;
          &lt;expiration-cache&gt;0&lt;/expiration-cache&gt;
          &lt;supports&gt;
              &lt;mime-type&gt;text/html&lt;/mime-type&gt;
              &lt;portlet-mode&gt;view&lt;/portlet-mode&gt;
              &lt;portlet-mode&gt;edit&lt;/portlet-mode&gt;
          &lt;/supports&gt;
          &lt;portlet-info&gt;
              &lt;title&gt;My Calendar Portlet&lt;/title&gt;
              &lt;short-title&gt;My Calendar Portlet&lt;/short-title&gt;
              &lt;keywords&gt;&lt;/keywords&gt;
          &lt;/portlet-info&gt;
          &lt;security-role-ref&gt;
              &lt;role-name&gt;administrator&lt;/role-name&gt;
          &lt;/security-role-ref&gt;
          &lt;security-role-ref&gt;
              &lt;role-name&gt;guest&lt;/role-name&gt;
          &lt;/security-role-ref&gt;
          &lt;security-role-ref&gt;
              &lt;role-name&gt;power-user&lt;/role-name&gt;
          &lt;/security-role-ref&gt;
          &lt;security-role-ref&gt;
              &lt;role-name&gt;user&lt;/role-name&gt;
          &lt;/security-role-ref&gt;
      &lt;/portlet&gt;
  &lt;/portlet-app&gt;
  </code></pre>
  
  <p>liferay-portlet.xml</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;!DOCTYPE liferay-portlet-app PUBLIC "-//Liferay//DTD Portlet Application 6.2.0//EN" "http://www.liferay.com/dtd/liferay-portlet-app_6_2_0.dtd"&gt;
  
  &lt;liferay-portlet-app&gt;
  
      &lt;portlet&gt;
          &lt;portlet-name&gt;my-calendar-portlet&lt;/portlet-name&gt;
          &lt;icon&gt;/icon.png&lt;/icon&gt;
          &lt;header-portlet-css&gt;/css/main.css&lt;/header-portlet-css&gt;
          &lt;footer-portlet-javascript&gt;
              /js/main.js
          &lt;/footer-portlet-javascript&gt;
          &lt;css-class-wrapper&gt;
              my-calendar-portlet-portlet
          &lt;/css-class-wrapper&gt;
      &lt;/portlet&gt;
      &lt;role-mapper&gt;
          &lt;role-name&gt;administrator&lt;/role-name&gt;
          &lt;role-link&gt;Administrator&lt;/role-link&gt;
      &lt;/role-mapper&gt;
      &lt;role-mapper&gt;
          &lt;role-name&gt;guest&lt;/role-name&gt;
          &lt;role-link&gt;Guest&lt;/role-link&gt;
      &lt;/role-mapper&gt;
      &lt;role-mapper&gt;
          &lt;role-name&gt;power-user&lt;/role-name&gt;
          &lt;role-link&gt;Power User&lt;/role-link&gt;
      &lt;/role-mapper&gt;
      &lt;role-mapper&gt;
          &lt;role-name&gt;user&lt;/role-name&gt;
          &lt;role-link&gt;User&lt;/role-link&gt;
      &lt;/role-mapper&gt;
  &lt;/liferay-portlet-app&gt;
  </code></pre>
  
  <p>Debug output from each key pressed:</p>
  
  <pre><code>22:18:22,328 DEBUG [DebugPhaseListener:64] BEFORE phaseId=[RESTORE_VIEW 1] viewId=[null]
  22:18:22,328 DEBUG [DebugPhaseListener:48] AFTER phaseId=[RESTORE_VIEW 1] viewId=[/views/my-calendar-portlet/view.xhtml]
  22:18:22,328 DEBUG [DebugPhaseListener:64] BEFORE phaseId=[RENDER_RESPONSE 6] viewId=[/views/my-calendar-portlet/view.xhtml]
  22:18:22,338 DEBUG [DebugPhaseListener:48] AFTER phaseId=[RENDER_RESPONSE 6] viewId=[/views/my-calendar-portlet/view.xhtml]
  </code></pre>