3 Replies Latest reply on Jul 10, 2009 1:23 AM by Tiago Reis

    h:messages And Url rewrite

    Tiago Reis Newbie


      In my project we have a template page that is used by almost every other page in the project.

      In that template we have a standard messages component to display messages to the user, and it worked ok.

      <h:messages id="messages"
              showDetail="true" globalOnly="true" styleClass="message"
              errorClass="errormsg" infoClass="infomsg" warnClass="warnmsg"
              rendered="#{showGlobalMessages != 'false'}">

      We then decided to use URL rewrite to change a little bit our links, for instance to home.xhml we added the following rules:

      <page view-id="/home.xhtml">
              <rewrite pattern="/home.xhtml?c={cid}&amp;k={conversationPropagation}" />
              <rewrite pattern="/home.xhtml?c={cid}" />
              <rewrite pattern="/home.xhtml" />

      (By the way, anyone know a way to completely hide the conversationPropagation let me know :-) )

      When we add this rule, the messages will no longer appear in that page.

      Does anyone have any idea on why do they not show up? Maybe its simple, but I have no idea on why.


        • 1. Re: h:messages And Url rewrite
          Tiago Reis Newbie


          I was tired when I wrote the last post, and forgot to mention somethings.

          The messages only disappear if the message is show after a redirect.

          Imagine : From page X you perform an action which add a message, and you are redirect to home.xhtm . With the rewrite rules no message is displayed, without the rewrite rules the message is displayed.

          Using : Seam 2.1.2, JBoss 5.0.1GA, Rich Faces 3.3.1

          Thanks in advance for any help you can provide me.

          • 2. Re: h:messages And Url rewrite
            Norman Richards Expert

            When I created the Seam URL rewriting system, I never had in mind the kind of rewriting you are doing.  I'm astonished that those rules do anything useful.

            Were you were there are facilities in Seam already to rename attributes like conversation id?

            • 3. Re: h:messages And Url rewrite
              Tiago Reis Newbie


              I wanted to make the link smaller (hide conversationPropagation). I didn't found and any way to do this, so I thought about using rewrite for this. If there is any other way please let me know.

              We want to end conversations when leaving pages to try to save some server memory, and the only way we found out was to add that parameter to links. Again if there is a better way please let me know.

              I found out that it is possible to define the cid parameter format in configuration, but i never found a way to define the conversatiomPropagation parameter.

              I'm new to seam and j2ee so I may be making some begginer errors.

              Thanks for the help you are providing.