9 Replies Latest reply on Aug 13, 2007 8:55 PM by nidhi_hs

    Change Page DisplayName Programmatically

    nidhi_hs

      Is there a way to change display name of a page programmatically ?
      My requirement is to change Page Name based on some condition .

      Thanks
      Srinidhi

        • 1. Re: Change Page DisplayName Programmatically
          explorer

          What do you mean by the Page Display name....

          Page - node or Browser display name...

          • 2. Re: Change Page DisplayName Programmatically
            nidhi_hs

            Browser display name. The name that gets displayed on the tabs.

            • 3. Re: Change Page DisplayName Programmatically
              nidhi_hs

              I acheived this by putting some logic in tabs.jsp.

              • 4. Re: Change Page DisplayName Programmatically
                explorer

                But you need to decide on where exactly you want to put it and how you want to change the name...

                If you are putting in tabs.jsp then.. i have a question.. are you changing based on the portlets being rendered for a current page...

                well usually you set the title using from portlets using renderer.setAttribute("headercontent",""); and having the headercontent tag in your layouts.
                this would actually put any of ur meta,script,link or title.. anything for that case..

                • 5. Re: Change Page DisplayName Programmatically
                  nidhi_hs

                  I am not changing the portlet title. I am changing the page display name. When I say page display name I mean the name of the tab.

                  My requirement was to change the "Sign In" tab name to "My Account" after user logs in. So I have a logic in tabs.jsp to check if the user has logged in.

                  • 6. Re: Change Page DisplayName Programmatically
                    explorer

                    I have one issue. I hope you would have a solution for that.

                    I am trying to get access to objects that i am setting in portal session from portlet session. Is that possible.?

                    • 7. Re: Change Page DisplayName Programmatically
                      nidhi_hs

                      Yes its possible. I struggled hard to get this solution.

                      Here is how you get portal session from a portlet (am using JSF portlet) -

                      ExternalContext context = FacesContext.getCurrentInstance().getExternalContext();
                      JBossActionRequest request = (JBossActionRequest) context.getRequest();
                      ServerInvocationContext serverContext = request.getControllerContext().getServerInvocation().getServerContext();
                      HttpServletRequest clientRequest = serverContext.getClientRequest();
                      HttpSession session = clientRequest.getSession();

                      context.getRequest() - will return JBossActionRequest or JBossRenderRequest based on the scenario

                      • 8. Re: Change Page DisplayName Programmatically
                        explorer

                        I am not using JSF

                        But i tried using the renderRequest...

                        ServerInvocationContext serverContext = jrr.getControllerContext().getServerInvocation().getServerContext();


                        That call is throwing the following exception.

                        19:36:16,531 ERROR [CommandServlet] Exception in command invocation
                        java.lang.LinkageError: Class org/jboss/portal/core/controller/ControllerContext violates loader constraints
                         at java.lang.ClassLoader.defineClass1(Native Method)





                        • 9. Re: Change Page DisplayName Programmatically
                          nidhi_hs

                          Not sure on the error. Its working for me. Which version of Jboss portal are you using. Am using 2.6.1