title: PrettyFaces error with required attribute
body: <p>I'm developing a web application using <strong>JSF 2</strong> and <strong>prettyfaces</strong>. I annotated one of my <code>@ViewScoped</code> beans with pretty annotations. That's what I have:</p>
  
  <pre><code>@ManagedBean
  @ViewScoped
  @URLMapping(parentId = "app-list", id = "app-view", pattern = "/detail/#{appId}",
      viewId = "/system/manage_app/content/app_detail/app_detail.xhtml")
  public class NavegableAppView extends SystemNavegable {
  
  /**
  </code></pre>
  
  <p>Basically that shows the details of an application which is installed in my system. This bean can be instanced in two ways, passing <code>#{appId}</code> param, which indicates the id of the application which I want to load, <strong>or</strong> without that param, in this case the bean will recover this id from a <code>@SessionScoped</code> bean. </p>
  
  <p>That's how the page <code>/system/manage_app/content/app_detail/app_detail.xhtml</code> is managing the parameter:</p>
  
  <pre><code>&lt;ui:composition xmlns="http://www.w3.org/1999/xhtml"
  xmlns:ui="http://java.sun.com/jsf/facelets"
  xmlns:f="http://java.sun.com/jsf/core"
  xmlns:h="http://java.sun.com/jsf/html"
  xmlns:c="http://java.sun.com/jsp/jstl/core"
  xmlns:p="http://primefaces.org/ui"
  template="/templates/general_template.xhtml"&gt;
  
  &lt;ui:define name="metadata"&gt;
      &lt;f:metadata&gt;
          &lt;f:viewParam id="appId" name="appId"
              value="#{navegableAppView._ParamApp}" required="false" /&gt;
          &lt;f:event type="preRenderView"
              listener="#{navegableAppView.initialize}" /&gt;
      &lt;/f:metadata&gt;
  &lt;/ui:define&gt;
  
  &lt;ui:define name="general_content"&gt;
      &lt;p:panel&gt;
  &lt;!--More stuff--&gt;
  </code></pre>
  
  <p>The problem here is I want <code>NavegableAppView</code> bean to be created, with or without param. I have tried this way <code>&lt;p:button value="prueba" outcome="pretty:app-view" /&gt;</code> which works but limits me to do nothing more than <strong>outcome</strong> and also <code>&lt;p:commandButton value="prueba2" action="pretty:app-view" ajax="false" /&gt;</code>, which is the equivalent to call an action method and return the navigation case (<strong>that's what really I want</strong>). </p>
  
  <p>First choice creates the bean properly and loads the value from the session. Second case, is giving me this error:</p>
  
  <pre><code> HTTP 500 - PrettyFaces: Exception occurred while building URL 
   for MappingId &lt; app-view &gt;, Required value &lt; #{appId} &gt; was null
  </code></pre>
  
  <p>So my target bean is not getting constructed. I have tried adding the parameter manually to the navigation case: <code>return pretty:app-view?appId=1</code> and it works, but I want the target bean to recover it from the session itself. Do I have to call a redirect or something like that in my action method?</p>
  
  <p>Pool your ideas.</p>