2 Replies Latest reply on Jul 28, 2011 8:11 AM by iga3k

    Howto use a custom tag handler in a portlet ?

      Maybe this is the wrong forum, so if it is - please move to the right one.

      My little problem is a custom tag handler - I hope I defined all needed stuff. Eclipse is working fine with my example tag - but my JBoss Portal Portlet doesnt touch the new tags.

      What I did :

      1. I created a tld file and put it into WEB-INF folder

      <?xml version="1.0" encoding="UTF-8" ?>
      <taglib xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd"
       version="2.1">
      
       <description>Tag Library 1.0</description>
       <display-name>Tags</display-name>
       <tlib-version>1.0</tlib-version>
       <short-name>durr</short-name>
       <uri>http://someurl/tags</uri>
      
       <tag>
       <description>Represents a basic filter container</description>
       <name>baseFilter</name>
       <tag-class>com.filter.BaseFilter</tag-class>
       <body-content>JSP</body-content>
       </tag>
      
      </taglib>
      


      2. I created a class BaseFilter, which compiles without errors
      public class BaseFilter extends TagSupport implements Tag{
       private static final Logger log = Logger.getLogger(LogbookInterface.class.getName());
       private static final long serialVersionUID = 1L;
      
       public void doTag() throws JspException, IOException {
       log.info("doTag()");
       pageContext.getOut().write("doTag()");
       }
      }


      3. I added my new taglib in my portlet jsp file
      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
       xmlns:f="http://java.sun.com/jsf/core"
       xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:rich="http://richfaces.org/rich"
       xmlns:a4j="http://richfaces.org/a4j"
       xmlns:c="http://java.sun.com/jsp/jstl/core"
       xmlns:fn="http://java.sun.com/jsp/jstl/functions"
       xmlns:fmt="http://java.sun.com/jsp/jstl/fmt"
       xmlns:durr="/WEB-INF/MyOwnTagLib.tld">
      


      4. Add a tag in my portlet jsp
      <durr:baseFilter/>
      



      When i execute my portlet jsp - my tag isnt touched and there is still
      <durr:baseFilter/>
      in my HTML. What did i wrong here? Or what did i miss?