title: viewParam value not set in ViewScoped bean
body: <p>Sorry, probably another really basic question. In my ViewScoped bean, a 'viewParam' looks like it's getting set, but when I come to use it, the value is null. I put a breakpoint in the setter (setEventId()) and it gets the value, but in the method specified by my preRenderView, it's gone, so I can't load the Event object I am trying to retrieve. </p>
  
  <p>This was working fine when my bean was RequestScoped, but I found that on a POST and subsequent validation error, all my details were lost and read that ViewScoped was the way to get around this problem. </p>
  
  <p>I have upgraded to Mojarra 2.1.7 because I thought it might be a bug, and indeed there is a 'critical bug' listed in their JIRA, fixed in 2.1.7, but I verified in the Glassfish logs that it was using the newer version, and I still get the same problem: <a href="http://java.net/jira/browse/JAVASERVERFACES-2266" rel="nofollow">http://java.net/jira/browse/JAVASERVERFACES-2266</a></p>
  
  <p>Please help, here's my bean (I have tried with and without the 'ManagedProperty' annotation)</p>
  
  <pre><code>@ViewScoped
  @Named
  public class EventController extends AbstractController {
  
      private static final Logger logger = Logger.getLogger("EventController");
  
      /**
       * Request param managed property
       */
      @ManagedProperty(value="#{param.eventId}")
      private Long eventId;                
  
      private Event event = new Event();
  
      /**
       * The event dao
       */
      @Inject
      private EventDao eventDao;    
  
      /**
       * Load the event (requires eventId has a value)
       * @return 
       */
      public void loadEvent() {
          event = eventDao.find(eventId);
      }    
  
      /**
       * @return the eventId
       */
      public Long getEventId() {
          return eventId;
      }
  
      /**
       * @param eventId the eventId to set
       */
      public void setEventId(Long eventId) {
          this.eventId = eventId;
      }   
  }
  </code></pre>
  
  <p>Here's how I'm constructing the link in the 'listEvents' page</p>
  
  <pre><code>&lt;h:link value="Full details" outcome="/calendar/viewEvent" includeViewParams="true"&gt;
  &lt;f:param name="eventId" value="#{calendarController.event.eventId}" /&gt;
  &lt;/h:link&gt;
  </code></pre>
  
  <p>And here's the page that needs the eventId property</p>
  
  <pre><code>&lt;?xml version='1.0' encoding='UTF-8' ?&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"
        xmlns:ui="http://java.sun.com/jsf/facelets"
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:p="http://primefaces.org/ui"
        xmlns:f="http://java.sun.com/jsf/core"
        xmlns:c="http://java.sun.com/jsp/jstl/core"&gt;
  
      &lt;body&gt;
  
          &lt;ui:composition template="/WEB-INF/templates/standardTemplate.xhtml"&gt;
  
      &lt;f:metadata&gt;
          &lt;f:viewParam name="eventId" value="#{eventController.eventId}"/&gt;
          &lt;f:event type="preRenderView" listener="#{eventController.loadEvent}" /&gt;
      &lt;/f:metadata&gt;            
  
              &lt;ui:define name="content"&gt;      
  
                  &lt;h1&gt;Event details for: #{eventController.event.title}&lt;/h1&gt;
                  &lt;h:form&gt;
                      &lt;p:messages/&gt;                                               
  
                      &lt;p:panelGrid style="margin-top:20px"&gt;  
                          &lt;f:facet name="header"&gt;  
                              &lt;p:row&gt;  
                                  &lt;p:column colspan="4"&gt;Event details&lt;/p:column&gt;  
                              &lt;/p:row&gt;  
                          &lt;/f:facet&gt;  
  
                          &lt;p:row&gt;  
                              &lt;p:column&gt;
                                  Title
                              &lt;/p:column&gt;  
                              &lt;p:column colspan="3"&gt;
                                  &lt;p:inputText value="#{eventController.event.title}" size="49"/&gt;
                                  &lt;h:inputHidden id="eventId" value="#{eventController.event.eventId}"/&gt;
                              &lt;/p:column&gt;   
                          &lt;/p:row&gt;                                                                                                   
                  &lt;/h:form&gt;                                
              &lt;/ui:define&gt;
          &lt;/ui:composition&gt;            
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>