2 Replies Latest reply on Sep 21, 2010 4:54 AM by Tamas Horvath

    Portal title

    Tamas Horvath Newbie

      Hi everybody!


      I would like to change the <title>...</title> of gatein page to some i18n solution with dynamic content. I know that the title from the xml cannot be dynamic and I cannot use EL expressions.

      I tried to write a filter but it does not receive the html content (including the dispatcher in filter config does not work) to process.

      I do not have any idea what to try. A js based solution may work but we would like to avoid it.

      If someone can help how to do this and how to use el expressions inside a filter would be great.




        • 1. Re: Portal title
          Trong Tran Master

          there is a topic that talks about changing the portal page title in a portlet http://community.jboss.org/message/555247


          could it help ?

          • 2. Re: Portal title
            Tamas Horvath Newbie

            I have found the solution for my entire problem:

            import org.exoplatform.portal.webui.util.Util;
                 String title;
                 try {
                     title = Util.getPortalRequestContext().getTitle();
                  } catch (Exception e) {
                     throw new IllegalStateException(response + " cannot be used to set title", e);
                  Element element = response.createElement("title");
                  ELContext el = FacesContext.getCurrentInstance().getELContext();
                  ValueExpression ve = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(el, title, Object.class);
                  title = ve.getValue(el).toString();
                  element.setTextContent("OurAppName - " + title);
                  response.addProperty(MimeResponse.MARKUP_HEAD_ELEMENT, element);


            This is the way to get and re-set the title in a phase listener. This is a way to i18n the title, and even to use el expressions in the page title desined in the xml. This code must run when the listenert called for the last portlet. Only RenderResponse response instance can do the trick.