2 Replies Latest reply: Aug 3, 2012 4:36 AM by Marek Schmidt RSS

    Parameter is never passed on a redirect of an exception at pages.xml

    Bruno Hernandes Newbie

      Hi.

       

      Im trying to pass a parameter to a managed bean responsible to centralize all exceptions in my application, but it seems that the parameter is never passed.

      Basically what im trying to do is:

       

      pages.xml:

       

      <?xml version="1.0" encoding="UTF-8"?>
      <pages login-view-id="/login.xhtml" no-conversation-view-id="/home.xhtml"
                xmlns="http://jboss.com/products/seam/pages" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                xsi:schemaLocation="http://jboss.com/products/seam/pages http://jboss.com/products/seam/pages-2.2.xsd">
      
      <exception class="java.lang.Exception" >
              <redirect view-id="/error.xhtml">
                   <message severity="error">#{messages['Error']}</message>
                   <param name="param1" value="valueOfMyParam"/>
              </redirect>
      </exception>
      </pages>
      

       

      /error.xhtml:

       

      <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
          xmlns:s="http://jboss.com/products/seam/taglib"
          xmlns:ui="http://java.sun.com/jsf/facelets"
          xmlns:f="http://java.sun.com/jsf/core"
          xmlns:h="http://java.sun.com/jsf/html"
          template="/layout/template.xhtml">
      
           <ui:define name="body">
                <h1><h:outputText value="#{errorPage.param1}" /></h1>
           </ui:define>
      
      </ui:composition>
      

       

      /error.page.xml:

       

      <?xml version="1.0" encoding="UTF-8"?>
      <page xmlns="http://jboss.com/products/seam/pages"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://jboss.com/products/seam/pages http://jboss.com/products/seam/pages-2.2.xsd">
      
           <param name="param1" value="#{errorPage.param1}"/>
      </page>
      
      

       

       

      ErrorPage.java:

       

       

      @Name("errorPage")
      public class ErrorPage implements Serializable {
      
           String param1;
      
           public void setParam1(String param1){
                this.param1 = param1;
           }
      
           public String getParam1(){
                return this.param1;
           }
      }
      

       

       

      But when my application throws an Exception the param1 value ("valueOfMyParam") never shows up on screen.

      Debugging the application i see that the setter method is never called.

      What im doing wrong here?

       

      Im Using Seam 2.2.

       

      Thx for the help.

       

        -- Bruno H.