Custom taglibs and XScript

Hi guys,
To simplify my jsp's in a portal 8.1 application I am considering
implementing some custom tags for often used constructs.
In this task I would like to pass some objects to the task-handler
and wonder if I can utilize dynamically attributes through the use
of XScript expressions.
Basically I want to implement a custom tag that will allow me to
do the following:
<custom:mytag value="{container.item.username}"/>
and then in the handler resolve {container.item.username} to
the correct object.
If not, how can I solve the issue of passing the object to my
custom tag?
TIA,
Claus Ljunggren

Eddie,
Thank you very much for your reply.
Actually I startet out using the exact method you suggest, but I found a
twist to make the solution far more elegant (in my oppinion that is).
My primary reason for creating the tags was to get rid of all those annoying
scriptlets. So naturally I didn't like the <%=%>'s! But it turns out that I
don't need them in my jsp's at all.
The netui-data:getData tag puts the value in the pageContext and the
pageContext is directly available from the TagSupport class! This means that
I can look the value up from the tag-handler instead of the jsp page. So all
I have to do is pass the name of the variable in the pageContext to my
tag-handler. End result beeing :
JSP:
<netui-data:getData value="{container.item.username}" resultId="username"/>
<custom:mytag resultId="username"/>
TAG-HANDLER:
public int doStartTag() {
String value = (String) pageContext.getAttribute(resultId);
Not the XScript vision I had, but close enough ... for now ;-)
Regards,
Claus Ljunggren
"Eddie O'Neil" <[email protected]> wrote in message
news:[email protected]...
Claus--
In 8.1, NetUI didn't expose a JSP tag SDK and thus we're not supportingbuilding custom tags that
extends NetUI ones.
That being said, there are some who are doing this, but there won't bea migration path for it
going from 8.1.x to 9.0.
The same functionality could be accomplished through a combination ofthe NetUI getData tag and
runtime expressions on your custom tags. For example:
<netui-data:getData value="{container.item.username}"resultId="theValue"/>
<custom:mytag value="<%= pageContext.getAttribute(theValue) %>"/>
This would also set your tags up well for the next WLS version and forNetUI in Beehive where we've
started using JSP 2.0 EL for expressions.
Hope that helps!
Eddie
Claus Ljunggren wrote:
Hi guys,
To simplify my jsp's in a portal 8.1 application I am considering
implementing some custom tags for often used constructs.
In this task I would like to pass some objects to the task-handler
and wonder if I can utilize dynamically attributes through the use
of XScript expressions.
Basically I want to implement a custom tag that will allow me to
do the following:
<custom:mytag value="{container.item.username}"/>
and then in the handler resolve {container.item.username} to
the correct object.
If not, how can I solve the issue of passing the object to my
custom tag?
TIA,
Claus Ljunggren

Similar Messages

  • Custom taglib and inexplicable jsp compilation issue

    Can someone explain what could possibly be happening here? I have been working on this for two days to no avail.
    With the following configuration, my jsp behaves as I expect it to on Tomcat, but fails to compile both for Jetty and the Maven2 jspc plugin
    deepfij.tld
    <taglib version="2.0" xmlns="http://java.sun.com/xml/ns/j2ee [3]" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-jsptaglibrary_2_0.xsd">
    <tlib-version>1.0</tlib-version>
    <short-name>deepfij</short-name>
    <uri>com.fijimf.deepfij</uri>
    <tag>
    <name>menuItem</name>
    <tag-class>com.fijimf.deepfij.web.tag.MenuItemTag</tag-class>
    <body-content>scriptless</body-content>
    <attribute>
    <name>item</name>
    <required>false</required>
    <rtexprvalue>true</rtexprvalue>
    </attribute>
    </tag>
    </taglib>
    menubar.jsp
    <%@ taglib prefix="df" uri="/WEB-INF/tlds/deepfij.tld"%>
    <c:forEach var="page" items="${menuRootPages}">
    <df:menuItem item="${page}" />  
    </c:forEach>
    MenuItemTag.java
    package com.fijimf.deepfij.web.tag;
    .With the error: com.fijimf.deepfij.web.tag cannot be resolved to a type.
    BUT*, if I move MenuItemTag into the package com.fijimf.web, and correspondingly change the .tld, everything works as expected.
    Is this a bug, or is there a constraint in taglib packages I don't know about?
    Any guidance would be great, because I'd like to put classes where I want them.

    This is most likely a bug on the server. The JSP formatted Tag Files usually have a .tag extension on them ( [see tutorial|http://java.sun.com/javaee/5/docs/tutorial/doc/bnama.html] ). The server is probably looking at yyy.xxx.tag and trying to use it as if it was a Tag File named xxx.tag, rather than a package.

  • Custom Taglibs

    Hi all
    Can any one tell me y Custom Taglibs came innto field what use to be there before and how they are used. what are the advantages and disadvantages of Custom Taglibs
    And also about struts tags
    Thanx in
    advance

    Tag libs keep scriptlets out of JSPs.
    http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/JSPTags.html

  • Runtime exceptions in custom taglib

    I am getting errors of the type:
              javax.servlet.ServletException: runtime failure in custom tag
              The problem is the error is happening in a taglib, but Weblogic is hiding the
              original stack trace, and substituting it's own, which is useless in this case. Is
              there any way to get the original stack trace?
              -Jeff
              

    With custom tags, each interface method needs to be entirely in a try..catch
              to support debugging. WL hides the exact exception information. For
              example:
              public int doEndTag() throws JspException
              try
              catch (Throwable e)
              throw e instanceof JspException ? (JspException) e : new
              JspTagException(e.getMessage());
              Cameron Purdy
              [email protected]
              http://www.tangosol.com
              WebLogic Consulting Available
              "Brian Homrich" <[email protected]> wrote in message
              news:[email protected]...
              > I'm getting the same type of error in the situation where an error has
              occured
              > in a page, my client uses "Back" on the browser, then tries another page
              > (which uses a custom taglib).
              >
              > If I stop, then restart WL, all is ok. The page where the runtime
              failure
              > occured is ok now.
              >
              > Have you made any progress getting a stack trace, and have you found
              anything
              > interesting?
              >
              > Does anyone know why a failure on one page would cause the custom tags
              > on another to fail like this? (Both pages use the same tag, but aren't
              calls
              > to a tag done independently?)
              >
              > Brian
              >
              > Jeff Nowakowski wrote:
              >
              > > I am getting errors of the type:
              > >
              > > javax.servlet.ServletException: runtime failure in custom tag
              > >
              > > The problem is the error is happening in a taglib, but Weblogic is
              hiding the
              > > original stack trace, and substituting it's own, which is useless in
              this case. Is
              > > there any way to get the original stack trace?
              > >
              > > -Jeff
              >
              

  • Custom taglib with nested tag not working

    Hi everybody,
    I have a question concerning a custom taglib. I want to create a tag with nested child tags. The parent tag is some kind of iterator, the child elements shall do something with each iterated object. The parent tag extends BodyTagSupport, i have overriden the methods doInitBody and doAfterBody. doInitBody initializes the iterator and puts the first object in the pageContext to be used by the child tag. doAfterBody gets the next iterator object and puts that in the pageContext, if possible. It returns with BodyTag.EVAL_BODY_AGAIN when another object is available, otherwise BodyTag.SKIP_BODY.
    The child tag extends SimpleTagSupport and does something with the given object, if it's there.
    In the tld-file I have configured both tags with name, class and body-content (tagdependent for the parent, empty for the child).
    The parent tag is being executed as I expected. But unfortunately the nested child tag does not get executed. If I define that one outside of its parent, it works fine (without object, of course).
    Can somebody tell me what I might have missed? Do I have to do something special with a nested tag inside a custom tag?
    Any help is greatly appreciated!
    Thanks a lot in advance!
    Greetings,
    Peter

    Hi again,
    unfortunately this didn't work.
    I prepared a simple example to show what isn't working. Perhaps it's easier then to show what my problem is:
    I have the following two tag classes:
    public class TestIterator extends BodyTagSupport {
        private Iterator testIteratorChild;
        @Override
        public void doInitBody() throws JspException {
            super.doInitBody();
            System.out.println("TestIterator: doInitBody");
            List list = Arrays.asList(new String[] { "one", "two", "three" });
            testIteratorChild = list.iterator();
        @Override
        public int doAfterBody() throws JspException {
            int result = BodyTag.SKIP_BODY;
            System.out.println("TestIterator: doAfterBody");
            if (testIteratorChild.hasNext()) {
                pageContext.setAttribute("child", testIteratorChild.next());
                result = BodyTag.EVAL_BODY_AGAIN;
            return result;
    public class TestIteratorChild extends SimpleTagSupport {
        @Override
        public void doTag() throws JspException, IOException {
            super.doTag();
            System.out.println(getJspContext().getAttribute("child"));
            System.out.println("TestIteratorChild: doTag");
    }The Iterator is the parent tag, the Child shall be shown in each iteration. My taglib.tld looks like the following:
    <?xml version="1.0" encoding="UTF-8"?>
    <taglib
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee web-jsptaglibrary_2_1.xsd"
         xmlns="http://java.sun.com/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.1">
         <tlib-version>1.0</tlib-version>
         <short-name>cms-taglib</short-name>
         <uri>http://www.pgoetz.de/taglibs/cms</uri>
         <tag>
              <name>test-iterator</name>
              <tag-class>de.pgoetz.cms.taglib.TestIterator</tag-class>
              <body-content>tagdependent</body-content>
         </tag>
         <tag>
              <name>test-iterator-child</name>
              <tag-class>de.pgoetz.cms.taglib.TestIteratorChild</tag-class>
              <body-content>empty</body-content>
         </tag>
    </taglib>And the snippet of my jsp is as follows:
         <!-- TestIterator -->
         <cms:test-iterator>
              <cms:test-iterator-child />
         </cms:test-iterator>The result is that on my console I get the following output:
    09:28:01,656 INFO [STDOUT] TestIterator: doInitBody
    09:28:01,656 INFO [STDOUT] TestIterator: doAfterBody
    09:28:01,656 INFO [STDOUT] TestIterator: doAfterBody
    09:28:01,656 INFO [STDOUT] TestIterator: doAfterBody
    09:28:01,656 INFO [STDOUT] TestIterator: doAfterBody
    So the child is never executed.
    It would be a great help if anybody could tell me what's going wrong here.
    Thanks and greetings from germany!
    Peter
    Message was edited by:
    Peter_Goetz

  • How to include custom taglib in javascript on a given jsp page

    Hi,
    How to include custom taglib in javascript on a given jsp page?
    i have a jsp page on which i am adding selectboxes using javascript.
    But now i have created my own custom select box and want to add it on a given jsp page.
    is the code to create the box box.
    <sample:pickListOptions employeeId="abcs123"/>
    but how should i embed it in javascript, so that i will be able to add it on the give jsp page.
    Thanks,
    Javaqueue

    when the jsp page is loaded for the first time it contains a select box containg names created by a taglib.but there is a feature i want to add wherein though javascript the name selectebox will keep on coming on each row i want to add. and this is row addition and deletion is being handled by the javascript. there i encounter the bug how to interact the javascript with taglib so tha with each row addition i will have populated taglib created select box on each row.
    Thanks,
    Javaqueue

  • Simple Question - How do I deploy custom taglibs to Oracle 9iAS r2?

    Simple question.
    There are lots of simple examples on JSP custom tags that have
    a .tld file, a .java file with the handler class, and a .jsp
    file that calls the custom tag to test it.
    My question is, lets say I have a .tld file, a .java file and
    a .jsp file for a tag example. How do I deploy them to
    Oracle 9iAS r2? I'd like to code an example and deploy it,
    but I'm stuck. I'm using Jdeveloper 9i, and have compiled the
    .java file and included it and the .tld in a Custom Taglib JAR.
    How is this JAR deployed to Oracle 9iAS, considering that the
    Enterprise Manager only deploys WAR and EAR files? How do
    a configure a web app to use the custom tags...
    This should be simple -- maybe its too simple so I'm stuck!

    check out ojspdemos which comes with the product.
    Also see
    http://otn.oracle.com/tech/java/oc4j/doc_library/902/jsp/taglibs.htm#1004903
    -Prasad

  • Custom TagLib & JSP Helpers

    I've written a custom tag library for some advanced UI components (tabbedpane, toolbar, tree, etc.) that I've been distributing for free as a .jar file with the associated .tld file. So far, so good.
    Now I want to write some more advanced tags (i.e. a DateSelection and Calculator tag) that will require some helper JSP files (and possibly images) to render the actual calendar and calculator.
    My plan is to have the tag generate a textfield with a hyerplink image to it's right. When clicked the image would load the helper JSP file in a new window. The user would do his thing and when done, the JSP would reload the parent window so the textfield could grab the result from the request and display it.
    My question is how to package this. I would like to keep this thing as a single self contained .jar file that could be easily placed in the WEB-INF directory of a user's webapp and VIOLA, it's done.
    Can I reference a .JSP (& | images) stored in this jar file or will the user have to be responsible for placing the JSP(s) (and the hyperlink images) within their context path? This would add some possible support issues (you know what I mean) and being a freeware package I'd like to avoid that at all costs.
    You guys have been tremendous help so far. Thanks.

    how will mailing the jar help ?
    I dont think you can include it all in the jarfile. Best thing is to make an entire war file with the developed taglib and jsp's.
    The user then should deploy the war file and ervything should work.

  • Custom taglib problem

    Hi I wrote some custom taglibs, but I get the
    following error:
    org.apache.jasper.JasperException: File "/dodo" not
    found
    I have the following configuration in my web.xml
    <taglib>
    <taglib-uri>/dodo</taglib-uri>
    <taglib-location>/WEB-INF/jsp/csajsp.tld</taglib-location>
    </taglib>
    and I call it in my jsp file in the following way:
    <%@ taglib uri="/dodo" prefix="c" %>
    And still doesn't work
    I'm using jdk 1.4.2 and tomcat 4.1.24.
    Any clues, thanks.

    That is right. The thing is that the custom tag example from tomcat works, and mine doesn't. Someone told me that it could be a jdk 1.4.2 issue, but thanks anyway.

  • JSP custom taglib

    Hi, I've a big problem:
    I tried to realize my first custom taglib for converting a .jasper file (a precompilated formatted meta-document) into a PDF file but I poorly failed... :(
    Unfortunatly, although the code run correctly into a main class into a stand alone sample application, the same code (opportunely adapted) doesen't work correctly if used by a JSP with its relative custom tag library.
    The error message is:
    javax.servlet.ServletException: Error loading expression class : report_semplice
         org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:872)
         org.apache.jasper.runtime.PageContextImpl.access$1100(PageContextImpl.java:114)
         org.apache.jasper.runtime.PageContextImpl$12.run(PageContextImpl.java:792)
         java.security.AccessController.doPrivileged(Native Method)
         org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:790)
         org.apache.jsp.reportPDF_jsp._jspService(reportPDF_jsp.java:82)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:141)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:861)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:325)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:306)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:861)
         sun.reflect.GeneratedMethodAccessor178.invoke(Unknown Source)
         sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         java.lang.reflect.Method.invoke(Method.java:324)
         org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:289)
         java.security.AccessController.doPrivileged(Native Method)
         javax.security.auth.Subject.doAsPrivileged(Subject.java:500)
         org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:311)
         org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:205)
    root cause
    javax.servlet.jsp.JspTagException: Error loading expression class : report_semplice
         com.tag.GeneratePDF.doEndTag(GeneratePDF.java:72)
         org.apache.jsp.reportPDF_jsp._jspx_meth_JR_GeneratePDF_0(reportPDF_jsp.java:99)
         org.apache.jsp.reportPDF_jsp._jspService(reportPDF_jsp.java:71)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:141)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:861)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:325)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:306)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:861)
         sun.reflect.GeneratedMethodAccessor178.invoke(Unknown Source)
         sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         java.lang.reflect.Method.invoke(Method.java:324)
         org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:289)
         java.security.AccessController.doPrivileged(Native Method)
         javax.security.auth.Subject.doAsPrivileged(Subject.java:500)
         org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:311)
         org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:205)
    The code of the taglib class is:
    package com.tag;
    import javax.servlet.jsp.*;
    import javax.servlet.jsp.tagext.*;
    import net.sf.jasperreports.engine.*;
    import net.sf.jasperreports.engine.export.*;
    import net.sf.jasperreports.engine.util.*;
    import net.sf.jasperreports.view.*;
    import java.sql.*;
    import org.apache.commons.logging.*;
    import java.io.*;
    import java.util.*;
    public class GeneratePDF extends TagSupport
      private String sourceFileName = "C:\\default.jasper";
      private String destinationFileName = "C:\\default.pdf";
      public void setSourceFileName(String sourceFileName)
        this.sourceFileName = sourceFileName;
      public void setDestinationFileName(String destinationFileName)
        this.destinationFileName = destinationFileName;
      public int doStartTag()
          return SKIP_BODY;
      public int doEndTag() throws JspTagException
        try
            //Passaggio parametri da passare al jasper.
            Map parameters = new HashMap();
            parameters.put("param1", new Integer(1));
            //Preparazione del file da stampare (in questa fase si esegue la query e si inseriscono
            //i valori estratti dalla query)
            JasperPrint jasperPrint=JasperFillManager.fillReport(sourceFileName, parameters, getConnection());
            // a schermo
            // JasperViewer.viewReport(jasperPrint);
           // test
           //pageContext.getOut().println("Destination File:" + destinationFileName);       
        //Creazione del PDF
            JasperExportManager.exportReportToPdfFile(jasperPrint, destinationFileName);
        //    System.exit(0);
           catch(Exception e)
                { throw new JspTagException(e.getMessage());
        return EVAL_PAGE;
    /**Metodo per creare la connessione al DB*/
    private static Connection getConnection() throws ClassNotFoundException, SQLException {
    //Change these settings according to your local configuration
    String driver = "sun.jdbc.odbc.JdbcOdbcDriver";
    String connectString = "jdbc:odbc:gecoware";
    String user = "admin";
    String password = "password";
    Class.forName(driver);
    Connection conn = DriverManager.getConnection(connectString, user, password);
    return conn;
    The .TLD file is:
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN" "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">
    <taglib>
        <tlibversion>1.0</tlibversion>
        <jspversion>1.1</jspversion>
        <shortname>JR</shortname>
        <uri>ReportTags</uri>
        <info>Tag library per la generazione di report a partire da files .jasper</info>
        <tag>
            <name>GeneratePDF</name>
            <tagclass>com.tag.GeneratePDF</tagclass>
            <bodycontent>empty</bodycontent>
            <info>Tag per la generazione di PDF</info>
            <attribute>
              <name>sourceFileName</name>
            </attribute>
            <attribute>
              <name>destinationFileName</name>
            </attribute>
        </tag>
    </taglib>
    And the JSP code is:
    <%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <%@ taglib uri="ReportTags" prefix="JR" %>
    <html>
    <head>
    <title>GeneratePDF</title>
    </head>
    <body>
    <JR:GeneratePDF sourceFileName="c:\\report_semplice.jasper" destinationFileName="c:\\report1.pdf"/>
    </body>
    </html>
    I hope that someone could help me...
    Thank you,
    AleX

    Hi,
              I think that the container can not identify the tag's ,what you are trying to use.
              As per the j2ee specification , we need to follow the procedure to use the taglib as given below
              Procedure for using a Tag Lib :
              â€¢ Copy tag lib jar files under WEB-INF/lib ( if tag handler supplied as classes without package a jar file then we need to copy the classes under WEB_INF/classes.
              â€¢ Copy the tld files files under WEB-INF or create a directory under WEB-INF and copy tld files under this directory.
              â€¢ We need to give the information about the tag libraries in web.xml by adding the following lines to it as,
              <taglib>
              <taglib-uri>http://www.inet.com/taglibs/bodytags</taglib-uri>
              <taglib-location>/WEB-INF/tlib/tlib1.tld </taglib-location>
              </taglib>
              To use tags in jsp file we need to add taglib directive as ,
              <%@ taglib uri="http://www.inet.com/taglibs/samptags" prefix=“abc"%>
              Every tag can support zero or more number of attributes and a tag may or may not support body content.
              weblogic server try to parse the .tld file whenever the tags are encountered in jsp files.
              As per the .tld file the container identify the attributes of the tags which were defined in .tld file.
              ------ Anilkumar kari

  • Custom taglibs w/ JSP features

    Hello Together,
    I am currently facing a little problem:
    I use custom taglibs for rendering certain web elements (lets say widgets etc.). The reason is greater reusability and full integration into the runtime. However, what do you recommend on how to render such components?
    As far as i know, there are only two solutions:
    - embedding markup (e.g. XHTML, XML...) into the tag class (not so good, especially when large chunks of markup)
    - reading from markup templates located on the file system and populating them w/ data (slow?).
    What do you use for custom taglibs that are to render markup contents (thus, no flow taglibs)?
    I know that i can fallback to pure JSPs, but there is no elegant way calling them with parameters. The reason is that i have "abstract control classes" with some properties. According to these properties, my taglib renders the control. When doing this with a JSP fragment, there is no "cool" way:
    the class proto: an GUI class with properties
    - id
    - caption
    - state
    - etc.
    -- taglib example --
    <some:guiElement obj="${controls.current}" method="xml" />
    This taglib can query all properties by the obj reference and render.
    -- JSP equivalent w/ JSTL call --
    <c:import url="/base/guiElement.jsp?id=${controls.current.id}&caption=${controls.current.caption}[...]" />
    This is bad design, and all params have to be passed seperately (or not?).
    You see, Taglibs are quite more handy to use, as you know. But i am missing JSP features in taglibs, such as how to do an <c:import /> from within an taglib etc.
    Another thing in mind is themeability. One can use a copy of the JSP fragment and modify its visual appearance, but w/ taglibs, that is more harder (except when using markup templates).
    Does anyone knoe how to marry JSP featires into custom taglibs?
    Sorry for that long posting :-)
    Greetings, Timo

    Hello,
    Just an answer to myself and anyone who is interested:
    The solution to my problem is migrating to JSP 2.0 where you can use tag template files.
    Thus, if possible, upgrading to JSP 2.0 + Servlet 2.4 does the job.
    Greetings, Timo

  • Extending functionality from existing custom taglib

    Hi!
    I'm trying to extend the functionality of an already existing custom taglib. To test this possibility I�ve so far created a small taglib containing two tags. QbeTag.java and QbeSumTag.java.
    The QbeTag class handles a database connection and constructs a table showing the result of a query passed in as an attribute in the tag. (The database contains a �dummy table� holding information about persons.)
    Now let�s pretend that I don�t have the source code for the QbeTag but need to/ want to extend its functionality. For instance:
    In the QbeSumTag I want to summarize all the persons ages and present it in a new text field somewhere else on the page.
    To do this I probably need to access the QbeTag class from the QbeSumTag class, or is there any other way to achieve this wanted functionality?
    Up to this point:
    What I�ve tried is to implement the QbeSumTag so that It extends the QbeTag class. This means that I now can access the doStartTag, doEndTag, and so on methods from the QbeSumTag by typing super.doStartTag().
    The problem with this approach is that this way only gives me the possibility to run the methods not altering the process it self and I can�t alter the out stream. A syntax like:
    public int doStartTag() throws JspException
    return super.doStartTag();
    Will only result in a call for the QbeTag�s doStartTag() method to run and do it�s stuff.
    Is there any way I can solve this or am I stuck? Maybe one approach would be to nest the QbeSumTag with the QbeTag wich would mean that there will be a dependency between the tow tags.
    I believe that this question is quite difficult to answer but it could be the starting point for an interesting discussion. Hasn�t anyone tried to extend the functionality of the Jakarta taglib, say the DB tags or Mail tag.
    All thoughts and replies will great fully received.
    /Daniel

    Well, the answer to this is the same as the answer to extending any third party classes... it depends on how the original class was created.
    If the original class was designed with extension in mind, then (hopefully) its realy functionality will be isolated to a series of protected methods (that you would have access to) and private methods (you would not have access to).
    You would use the public and protected methods to retrieve the data you need to do your work, or override those ones whose work you want to replace (for instance, if it has a protected displayOutput(Map dataMap) method, you are in luck!).
    If everything is done giving you know access to the pieces, then you may be stuck providing a tag that has the original tag nested inside it. Buffer the output from the original tag and parse it, retrieving the info you need, then output your own stuff...

  • Run-Time expression evaluation does not work with custom TagLib

              Hi,
              Using "WebLogic EJB to JSP Integration Tool", we have created a custom TagLib.
              We can properly deploy/start our Web application (a WAR file), but whenever we
              go to the JSP page that is using the custom Tag, we get the following exception:
              java.lang.ClassCastException: java.lang.Object
              at javax.servlet.jsp.tagext.TagData.getAttributeString(TagData.java:165)
              Here is what we have in our JSP page:
              <%@ taglib uri="Students-tags" prefix="students" %>
              <%
              String studentID = (String)session.getAttribute("studentID");
              %>
              <students:Register studentID="<%=studentID%>" />
              <%
              And the TLD file looks like this:
              <?xml version="1.0" encoding="ISO-8859-1" ?>
              <!DOCTYPE taglib
              PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN" "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">
              <taglib>
              <tlibversion>1.0</tlibversion>
              <shortname>ejb2jsp generated tag library</shortname>
              <tag>
              <name>Register</name>
              <tagclass>EJBs.Students.jsp_tags._Students_RegisterTag</tagclass>
              <teiclass>EJBs.Students.jsp_tags._Students_RegisterTagTEI</teiclass>
              <info>
              attribute 'studentID' expects java type 'java.lang.String'
              </info>
              <attribute>
              <name>studentID</name>
              <required>true</required>
              <rtexprvalue>true</rtexprvalue>
              </attribute>
              </tag>
              </taglib>
              and Web.xml file does have the following entry:
              <taglib>
              <taglib-uri>
              Students-tags
              </taglib-uri>
              <taglib-location>
              /WEB-INF/Students-tags.tld
              </taglib-location>
              </taglib>
              Does anybody knows whay Do I get such an exception ?
              

    You might want to ask this in a servlet/jsp interest group.

  • Q:Custom Taglibs in jDeveloper 9i RC

    I'm making a project with jsp's and custom taglibs. I created the taglib with the wizard and it is saved in ..\src\META-INF\xxx.tld. But when I need to it into the JSP it searches for a tld file from the public_html directory.
    Should I copy this file manually in the public_html directory ? Or should I change a setup somewhere ? I also did a deployment of the taglib into a .jar file. Is there a way to include and use it directly ?
    Thanks !

    Hi Mike, thanks for your help, it works.
    But now, the problem moved to another point: EL Expressions.
    My custom taglib needs to receive BPMObjects attributes (by EL assignment), so:
    If i keep the <install_dir>\webapps\workspace\WEB-INF\web.xml file as standard my ${object.attribute} is passed by as a string, not a EL, even if my custom tld accepts EL.
    If I change the web.xml above, turning off the <el-ignored> configuration it works
    <jsp-config>
            <jsp-property-group>
                <url-pattern>*.jsf</url-pattern>
                <is-xml>false</is-xml>
            </jsp-property-group>
            <jsp-property-group>
                <url-pattern>*.jsp</url-pattern>
                <url-pattern>*.jspf</url-pattern>
                <el-ignored>false</el-ignored>
            </jsp-property-group>
        </jsp-config>but then i get a problem with core jstl "c" using this URI
    *<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%>*
    According to TLD or attribute directive in tag file, attribute value does not accept any expressions
    even if a change it URI to
    *<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>*
    i have
    The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application
    So, have you faced this issue before? There is an way to change the core tld file within obpm jars?
    thanks again

  • JSP Custom Taglib Help

    Dear All,
    I am developing a simple calender system where I want to be able to add entries for a specific time and date similar to Outlook. I have a customer Taglib to create an Outlook style calendar. I can hard code entries such as below in the JSP but am not sure how I could generate these dynamically by filling in a booking form. Any guidance would be much appreciated as I have spent hours reading JSP books and websites without a resolution.
    <CAL:outlook width="220px" end="21" onClick="setEvent">
    <CAL:event start="10:00" end="11:00" eventMark="#00FF33">Meeting 1</CAL:event>
    <CAL:event start="11:30" end="13:00">Meeting 1</CAL:event>
    <CAL:event start="13:30" end="14:00">Meeting 2</CAL:event>
    </CAL:outlook>
    Thanks in advance
    Message was edited by:
    MikeS27
    Message was edited by:
    MikeS27

    Apologies, I have posted this in the wrong forum. Relocating.

Maybe you are looking for

  • ICON in ALV

    HI All, I have to display tick mark icon in one of the columns of ALV report. How can i do it. Please suggest me. Regards, Monika

  • Hard drive for back up, new i7 MbookPro

    Can anyone advise on a thunderbolt drive purchase?

  • After 2.1 update still getting dropped calls

    After 2.1 update I have dropped at least 15 Phone calls , the signal strength is usually on 5 bars 3g , the calls drop without warning (doesnt break up or destort voice), It also seems if I look at email while on a call it drops the call about 20 sec

  • Playing movie clips one after the other

    Hello, I am trying to figure out how to play several movie clips one after the other. Each clip has animation in it. When I drag the clip on the main timeline the timeline plays the frame but does not play the contents of the movie. how do I get it t

  • Delivery Related Billing rather than Order Related Billing in Return Sales

    Hi There is a requirement from the client that the Returns Invoice (RE) generated must be related to LR Delivery Type rather than Return Sales Order Type(RE). I have maintained the Copy Control from LR (Returns Delivery Type) to RE(Returns Invoice Ty