5 Replies Latest reply on Feb 9, 2006 4:08 PM by Michael Caughey

    portlet taglib actionURL

    Michael Caughey Newbie

      I'm using JBoss Portal 2.2.0 on Jboss AS 4.0.3SP1

      I'm trying to post tothe actionURL of a portlet. I'm doing the following in my JSP:

      <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
      <%@ taglib uri="http://java.sun.com/portlet" prefix="portlet"%>
      
      
      <c:set var="menuLinkURL">
       <portlet:actionURL>
       <portlet:param name="action" value="Menu" />
       </portlet:actionURL>
      </c:set>
      <script>
       function postMenuForm(id){
       document.postMenu.id.value = id;
       document.postMenu.submit();
       }
      </script>
      <form id="post-menu" name="postMenu" action="${menuLinkURL}" method="POST">
       <input type="hidden" name="id" />
      </form>
      <table border="0" width="450">
       <tr>
       <td align="center" width="90">
       <a href="javascript:postMenuForm(1)">User</a>
       </td>
       <td align="center" width="90">
       <a href="javascript:postMenuForm(2)">Game</a>
       </td>
       <td align="center" width="90">
       <a href="javascript:postMenuForm(3)">Table</a>
       </td>
       <td align="center" width="90">
       <a href="javascript:postMenuForm(4)">Messaging</a>
       </td>
       <td align="center" width="90">
       <a href="javascript:postMenuForm(5)">DB Lists</a>
       </td>
       </tr>
      </table>
      


      I've got an error in Eclipse that reads:

      No tag "actionURL" defined in tag library imported with prefix "portlet"


      When I run the application the and click on the User menu item I get the following URL in the address bar:


      http://localhost:8080/portal/portal/gameadmin/${menuLinkURL}


      What boggles my ind to no end is that I did the same thing in a proof of concept and it worked. so obviously i've configured something wrong in this new applicaton.

      I do notice that the portal-lib.tld in my Web-inf directory doesn't have an actionURL tag defined.

      <?xml version="1.0" encoding="UTF-8" ?>
      
       <taglib xmlns="http://java.sun.com/xml/ns/j2ee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-jsptaglibrary_2_0.xsd"
       version="2.0">
      
       <tlib-version>1.1</tlib-version>
       <jsp-version>2.0</jsp-version>
       <shortname>JBoss Portal tags</shortname>
       <info>JBoss Portal tags</info>
       <uri>http://java.sun.com/portlet</uri>
      
       <function>
       <name>i18n</name>
       <function-class>org.jboss.portal.core.servlet.jsp.taglib.PortalLib</function-class>
       <function-signature>java.lang.String getMessage(java.lang.String)</function-signature>
       </function>
      
       <function>
       <name>out</name>
       <function-class>org.jboss.portal.core.servlet.jsp.taglib.PortalLib</function-class>
       <function-signature>java.lang.String out(java.lang.String)</function-signature>
       </function>
      
       <function>
       <name>i18nout</name>
       <function-class>org.jboss.portal.core.servlet.jsp.taglib.PortalLib</function-class>
       <function-signature>java.lang.String i18nOut(java.lang.String)</function-signature>
       </function>
      
       <tag>
       <name>if</name>
       <tagclass>org.jboss.portal.core.servlet.jsp.taglib.IfTag</tagclass>
       <attribute>
       <name>ctx</name>
       <required>true</required>
       <rtexprvalue>true</rtexprvalue>
       </attribute>
       </tag>
      
       <tag>
       <name>iterate</name>
       <tagclass>org.jboss.portal.core.servlet.jsp.taglib.IterateTag</tagclass>
       <attribute>
       <name>ctx</name>
       <required>true</required>
       <rtexprvalue>true</rtexprvalue>
       </attribute>
       </tag>
      
       <tag>
       <name>include</name>
       <tagclass>org.jboss.portal.core.servlet.jsp.taglib.IncludeTag</tagclass>
       <attribute>
       <name>page</name>
       <required>true</required>
       <rtexprvalue>true</rtexprvalue>
       </attribute>
       </tag>
      
       <tag>
       <name>error</name>
       <tagclass>org.jboss.portal.core.servlet.jsp.taglib.ErrorTag</tagclass>
       <attribute>
       <name>key</name>
       <required>true</required>
       <rtexprvalue>true</rtexprvalue>
       </attribute>
       </tag>
      
       <tag>
       <name>errors</name>
       <tagclass>org.jboss.portal.core.servlet.jsp.taglib.ErrorsTag</tagclass>
       </tag>
      
       <tag>
       <name>success</name>
       <tagclass>org.jboss.portal.core.servlet.jsp.taglib.SuccessTag</tagclass>
       </tag>
      </taglib>
      


      I added the URI line bcuase when its not there the JSP flags an error that it caould not find a library with the URI. I mention that becuse that may well be at the root of my problem, and I don;t know how to fix that one either.


      Thanks,
      -Michael

        • 1. Re: portlet taglib actionURL
          l.forni Newbie

          OK... First of all, ActionURL is a tag of portlet.tld, so you don't need to include to your project War

          You have forgotten this tag:

          <portlet:defineObjects/>

          You have to insert it before using tag like
          <portlet:....


          So, it would be like this:
          <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
          <%@ taglib uri="http://java.sun.com/portlet" prefix="portlet"%>
          
          <portlet:defineObjects/>
          
          <c:set var="menuLinkURL">
           <portlet:actionURL>
           <portlet:param name="action" value="Menu" />
           </portlet:actionURL>
          </c:set>
          ...
          


          Hope this help you!!
          Bye
          Luca Forni

          • 2. Re: portlet taglib actionURL
            Michael Caughey Newbie

            Ok I did that:

            
            <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
            <%@ taglib uri="http://java.sun.com/portlet" prefix="portlet"%>
            
            <portlet:defineObjects/>
            
            <c:set var="menuLinkURL">
             <portlet:actionURL>
             <portlet:param name="action" value="Menu" />
             </portlet:actionURL>
            </c:set>
            <script>
             function postMenuForm(id){
             document.postMenu.id.value = id;
             document.postMenu.submit();
             }
            </script>
            
            


            But now I get three errors listed in eclipse:

            File "http://java.sun.com/portlet" not found.

            and

            The absolute uri: http://java.sun.com/portlet cannot be resolved in either web.xml or the jar files deployed with this application.

            and

            No tag "defineObjects" defined in tag library imported with prefix "portlet"




            I changed the line to this:

            <%@ taglib uri="http://java.sun.com/portlet.tld" prefix="portlet"%>
            


            so it now looks like this:
            <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
            <%@ taglib uri="http://java.sun.com/portlet.tld" prefix="portlet"%>
            
            <portlet:defineObjects/>
            
            <c:set var="menuLinkURL">
             <portlet:actionURL>
             <portlet:param name="action" value="Menu" />
             </portlet:actionURL>
            </c:set>
            <script>
             function postMenuForm(id){
             document.postMenu.id.value = id;
             document.postMenu.submit();
             }
            </script>
            <form id="post-menu" name="postMenu" action="${menuLinkURL}" method="POST">
             <input type="hidden" name="id" />
            </form>
            
            


            Note the TLD suffix. the errors went away in one file, my menu file but I have the same thing in another file for sub menus and I get the same erros mentioned above only this time ther portlet text is changed to portlet.tld. So why does it work on one page and not the other.

            Here is the code for the second.

            <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
            <%@ taglib uri="http://java.sun.com/portlet.tld" prefix="portlet"%>
            
            <portlet:defineObjects/>
            
            <c:set var="submenuLinkURL">
             <portlet:actionURL>
             <portlet:param name="action" value="SubMenu" />
             </portlet:actionURL>
            </c:set>
            <script>
             function postSubMenuForm(id){
             document.postSubMenu.id.value = id;
             document.postSubMenu.submit();
             }
            </script>
            <form id="post-submenu" name="postSubMenu" action="${submenuLinkURL}" method="POST">
             <input type="hidden" name="id" />
            </form>
            
            


            Thanks for your help,
            michael

            • 3. Re: portlet taglib actionURL (Need additional Help)
              Michael Caughey Newbie

              Please see my last message in the thread,

              Thanks,
              Michael

              • 4. Re: portlet taglib actionURL
                Michael Caughey Newbie

                when I run this I get the following error at runtime

                The absolute uri: http://java.sun.com/portlet.tld cannot be resolved in either web.xml or the jar files deployed with this application


                • 5. Re: portlet taglib actionURL
                  Michael Caughey Newbie

                  when I use

                  <%@ taglib uri="http://java.sun.com/portlet" prefix="portlet"%>
                  


                  Now I don't get an error in in eclipse or on execution but, I don't get the URL

                  My URL looks like:


                  http://localhost:8080/portal/portal/gameadmin/${menuLinkURL}