3 Replies Latest reply on Jul 12, 2006 3:33 AM by louise_za

    Portlet tag interpretation sequence

    louise_za

      Hi

      I have a class that generates some jsp code for me when calling on a specific method. This code includes the <portlet:ActionURL> tag:

      public String getChildren(String id)
       {
       String children;
       children = "\t<portlet:actionURL windowState=\"normal\" portletMode=\"view\" var=\"actionUrl\">\n" +
       "\t\t<portlet:param name=\"id\" value=\"" + id + "\"/>\n" +
       "\t</portlet:actionURL>\n" +
       "<script>\n" +
       "\t <a href=\"<%=actionUrl>\">The link</a>";
      
       }


      In my jsp I have a call to the method and then write out the variable containing the generated code:
      <%
       String children = db.getChildren();
      %>
      
      <%=children%>


      The problem is that the actionUrl does not get interpreted and the link url looks something like this:
      http://10.0.0.198:8080/portal/portal/default/<%=actionUrl%>

      How can I force the jsp page to interpret the contents of the 'children' string so that the correct link is formed?

        • 1. Re: Portlet tag interpretation sequence
          louise_za

          In the above code excerpt I forgot to add the return statement in the getChildren method. The code should look as follows:

          public String getChildren(String id)
           {
           String children;
           children = "\t<portlet:actionURL windowState=\"normal\" portletMode=\"view\" var=\"actionUrl\">\n" +
           "\t\t<portlet:param name=\"id\" value=\"" + id + "\"/>\n" +
           "\t</portlet:actionURL>\n" +
           "<script>\n" +
           "\t <a href=\"<%=actionUrl>\">The link</a>";
          
           return children;
          
           }


          The actual value of the string returned looks as follows, for example:
           <portlet:actionURL windowState="normal" portletMode="view" var="actionUrl">
           <portlet:param name="id" value="1009"/>
           </portlet:actionURL>
          <script>
           tree.add(1,' ESM Results','_self', '<%= actionUrl %>','', '', '');
          
          

          In the above problem the javascript elements work fine. It is the <portlet:ActionURL> tag that does not get generated. The actionUrl variable is passed as is in a text form and not as the actual action URL.

          So, when someone clicks on the link they get the HTTP400 - Bad Request error because the link is built to look like this:
          http://10.0.0.198:8080/portal/portal/default/<%=actionUrl%>


          • 2. Re: Portlet tag interpretation sequence
            louise_za

            Is there a specific point during the compilation of a jsp when all the portlet specific variables/tags are interpreted and converted into their actual values?

            Any help will be much appreciated.

            • 3. Re: Portlet tag interpretation sequence
              louise_za

              Sorry, made another mistake...what happens when you don't want to post all your code and there is no edit button!

              The code exerpt above detailing the actual value of the string returned should be:

               <portlet:actionURL windowState="normal" portletMode="view" var="actionUrl">
               <portlet:param name="id" value="1009"/>
               </portlet:actionURL>
              <script>
               <a href="<%=actionUrl%>">The link</a>
              


              Anyway, the gist is still the same :)