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

Similar Messages

  • 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.

  • How to pass attribute values through variables in JSP  Custom TagLib

    Hi,
    Can anybody help me how to pass values through varuables in the jsp custom tag.
    i am using JSP custom tag. I am unable to pass attribute values through variables.
    <invitation:invdetails invid="<%=invid%>"/> The value is passing as <%=invid%> ,not value of the invid.
    But i am getting throuh the fllowing
    <invitation:invdetails invid='1' />
    Please anybody suggest me how to pass value by using the variable.

    Hi,
    It sounds like you need to set the <rtexprvalue> tag to true in the TLD for your tag. If you do this the tag will read in the value you are trying to pass to it.
    dapanther...

  • 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

  • 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

  • Connection Pooling and JSP Custom Tag Library - is code (inside) the best way/correc?

    Hi, can anyone advise as to whether my tag library code (based
    on Apache Jakarta Project) will actually achieve connection
    pooling functionality across my entire JSP based application? I
    am slightly concerned that my OracleConnectionCacheImpl object
    may exist multiple times, hence rendering my conection pooling
    attempt useless.
    package com.solved.tag.dbtags.connection;
    import java.io.IOException;
    import java.sql.Connection;
    import java.sql.SQLException;
    import javax.servlet.jsp.tagext.TagSupport;
    import javax.servlet.jsp.JspTagException;
    import javax.sql.DataSource;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    import oracle.jdbc.pool.OracleConnectionCacheImpl;
    * <p>JSP tag connection, used to get a
    * java.sql.Connection object.</p>
    * <p>JSP Tag Lib Descriptor
    * <pre>
    * &lt;name>connection&lt;/name>
    &lt;tagclass>com.solved.tag.dbtags.connection.ConnectionTag&lt;/t
    agclass>
    * &lt;bodycontent>JSP&lt;/bodycontent>
    &lt;teiclass>com.solved.tag.dbtags.connection.ConnectionTEI&lt;/t
    eiclass>
    * &lt;info>Opens a connection based on a jndiName.&lt;/info>
    * &lt;attribute>
    * &lt;name>id&lt;/name>
    * &lt;required>true&lt;/required>
    * &lt;rtexprvalue>false&lt;/rtexprvalue>
    * &lt;/attribute>
    * </pre>
    * @author Matt Shannon
    public class ConnectionTag extends TagSupport {
    static private OracleConnectionCacheImpl cache = null;
    public int doStartTag() throws JspTagException {
    try {
    Connection conn = null;
    if (cache == null) {
    try {
    InitialContext ic = new InitialContext();
    DataSource ds = (DataSource) ic.lookup
    ("jdbc/pool/OracleCache");
    cache = (OracleConnectionCacheImpl)ds;
    catch (NamingException ne) {
    throw new JspTagException(ne.toString());
    conn = cache.getConnection();
    pageContext.setAttribute(getId(),conn);
    catch (SQLException e) {
    throw new JspTagException(e.toString());
    return EVAL_BODY_INCLUDE;
    package com.solved.tag.dbtags.connection;
    import java.sql.Connection;
    import java.sql.SQLException;
    import javax.servlet.jsp.tagext.TagSupport;
    * <p>JSP tag closeconnection, used to close the
    * specified java.sql.Connection.<p>
    * <p>JSP Tag Lib Descriptor
    * <pre>
    * &lt;name>closeConnection&lt;/name>
    &lt;tagclass>com.solved.tag.dbtags.connection.CloseConnectionTag&
    lt;/tagclass>
    * &lt;bodycontent>empty&lt;/bodycontent>
    * &lt;info>Close the specified connection. The "conn"
    attribute is the name of a
    * connection object in the page context.&lt;/info>
    * &lt;attribute>
    * &lt;name>conn&lt;/name>
    * &lt;required>true&lt;/required>
    * &lt;rtexprvalue>false&lt;/rtexprvalue>
    * &lt;/attribute>
    * </pre>
    * @author Matt Shannon
    * @see ConnectionTag
    public class CloseConnectionTag extends TagSupport {
    private String _connId = null;
    * The "conn" attribute is the name of a
    * page context object containing a
    * java.sql.Connection.
    * @param connectionId
    * attribute name of the java.sql.Connection to
    close.
    * @see ConnectionTag
    public void setConn(String connectionId) {
    _connId = connectionId;
    public int doStartTag() {
    try {
    Connection conn = (Connection)pageContext.getAttribute
    (_connId);
    conn.close();
    } catch (SQLException e) {
    // failing to close a connection is not fatal
    e.printStackTrace();
    return EVAL_BODY_INCLUDE;
    public void release() {
    _connId = null;
    package com.solved.tag.dbtags.connection;
    import javax.servlet.jsp.tagext.TagData;
    import javax.servlet.jsp.tagext.TagExtraInfo;
    import javax.servlet.jsp.tagext.VariableInfo;
    * TagExtraInfo for the connection tag. This
    * TagExtraInfo specifies that the ConnectionTag
    * assigns a java.sql.Connection object to the
    * "id" attribute at the end tag.
    * @author Matt Shannon
    * @see ConnectionTag
    public class ConnectionTEI extends TagExtraInfo {
    public final VariableInfo[] getVariableInfo(TagData data)
    return new VariableInfo[]
    new VariableInfo(
    data.getAttributeString("id"),
    "java.sql.Connection",
    true,
    VariableInfo.AT_END
    data-sources.xml:
    <?xml version="1.0"?>
    <!DOCTYPE data-sources PUBLIC "Orion data-
    sources" "http://xmlns.oracle.com/ias/dtds/data-sources.dtd">
    <data-sources>
    <data-source
    class="oracle.jdbc.pool.OracleConnectionCacheImpl"
    name="jdbc/pool/OracleCache"
    location="jdbc/pool/OracleCache"
    url="jdbc:oracle:thin:@oracle1:1521:pdev"
    >
    <property name="maxLimit" value="15" />
    <property name="cacheScheme" value="2" />
    <property name="user" value="console" />
    <property name="password" value="console" />
    <description>
    This DataSource is using an Oracle-native DataSource Class so as
    to allow Oracle Specific extensions.
    A getConnection() call on this DataSource will return
    oracle.jdbc.driver.OracleConnection.
    The connection returned is a logical connection.
    The caching scheme in place is Fixed Wait. Refer below to
    possible values.
    Dynamic 1
    Fixed Wait 2
    Fixed Return Null 3
    </description>
    </data-source>
    </data-sources>
    many thanks,
    Matt.

    Hi. Show me your pool definition.
    Joe
    Ramamurthy wrote:
    I am using the jsp custom tag library from BEA called sqltags.tld which came with Weblogic 5.1. Currently I am using Weblogic6.1 sp2 on Solaris.
    I have created a Connection Pool for Sybase database using the driver com.sybase.jdbc.SybDriver.
    When I created jsp page to connect to the connection pool using sqltags custom tag library, I am getting the error
    "javax.servlet.jsp.JspException: Failed to write body content
    at weblogic.taglib.sql.ConnectionTag.doAfterBody(ConnectionTag.java:43)
    at jsp_servlet.__hubwcdata._jspService(__sampletest.java:1014)"
    After this message, whenever I try to access the same jsp page I am getting the message
    "javax.servlet.jsp.JspException: Failed to load JDBC driver: weblogic.jdbc.pool.D
    river
    at weblogic.taglib.sql.ConnectionTag.doStartTag(ConnectionTag.java:34)
    at jsp_servlet.__hubwcdata._jspService(__sampletest.java:205)".
    Can you please help me the reason why this problem is happening and how to fix this ?
    This problem doexn't happen consistently. This occurs once in a while.
    I tried to increase Login delay Seconds parameter in the Connection Pool to 15 sec. It didn't help me much.
    Thanks for your help !!!
    Ram

  • How to use JSP custom tag lib in PAR file?

    Hi All,
    I am trying to customize mastheaderpar file. For that I have downloaded relevant par file and making the changes accordingly.
    As part of the changes I would require to use JSP custom tag library in my par file.
    I have the TLD file and relevant classes in the jar file. I would like to know where and what kind of modifications have to be done to use the jsp custom tag library.
    I tried modifying some things in portalapp.xml but was not successful.
    Please help me on how to proceed with this? It would be great if you can provide the xml entry to use this tag library
    Thanks
    Santhosh

    Hi Johny,
    Thanks for the reply. Actually I am able to change colors etc. with out any problem.
    My requirement is to use XMLTaglib in mastheader par file. This tag lib is from apache tomcat. I have the relevant TLD and class files. I copied TLD file into taglib dir of portal-inf and class file in src api.
    And I have added the following line in portalapp.xml under component-profile section of default
    <property name="tlxtag" value="/SERVICE/Newmastheader/taglib/taglibs-xtags.tld">
    Is this the right way to use tag lib? Actually before adding this line I used to get the error saying "Error parsing taglib", but now the error does not occur and I am getting new error. This is an exception in one of the taglib classes.
    Could any one provide me some inputs on how to check this error?
    Thanks
    Santhosh

  • 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

  • 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

  • Error in JSP Custom Tag Program

    Hi Dear,
    when I compile my JSP Custom tag program on weblogic Its give that Error..
    Parsing of JSP File '/Home.jsp' failed: /Home.jsp(-1): cannot load TLD: weblogic.xml.dom.ChildCountException: missing child tagclass in tag
    probably occurred due to an error in /Home.jsp line -1:
    Tue Sep 09 18:46:56 GMT 2008
    My Files are:
    Home.jsp:
    <%@ taglib uri="/WEB-INF/tlds/taglib.tld" prefix="neeraj" %>
    <neeraj:hello name="Vijay">
    It is a Tag Body<br>
    </neeraj:hello>
    taglib.tld:
    <taglib>
    <tlib-version>1.0</tlib-version>
    <jsp-version>1.2</jsp-version>
    <uri>WEB-INF/tlds/taglib.tld</uri>
    <tag>
    <name>hello</name>
    <tag-class>mypack.MyTag</tag-class>
    <attribute>
    <name>name</name>
    <required>true</required>
    </attribute>
    </tag>
    </taglib>
    MyTag.java:
    package mypack;
    import javax.servlet.jsp.*;
    import javax.servlet.jsp.tagext.*;
    public class MyTag extends TagSupport
    String name;
    public void setName(String c)
    try
    name=c;
    catch(Exception e)
    count=1;
    public int doStartTag()
    return EVAL_BODY_INCLUDE;
    public int doAfterBody
    JspWriter out=pageContext.getOut();
    out.print("Good Night "+name);
    catch(Exception e)
    return EVAL_PAGE;
    web.xml:
    <web-app>
    <welcome-file-list>
    <welcome-file>/Home.jsp</welcome-file>
    </welcome-file-list>
    <taglib>
    <taglib-uri>taglib</taglib-uri>
    <taglib-location>/WEB-INF/tlds/taglib.tld</taglib-location>
    </taglib>
    </web-app>
    Please resolve my issue..

    I had the same problem. In your .tld change tagclass to tag-class and bodycontent to body-content and that should do the trick. The names slightly changed for JSP spec 1.2.
              

  • 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.

  • 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

  • Import custom taglib??/

    I'm a newbee with UIX, sorry if this question seems stupid. How do you go about importing a custom taglib into UIX application?
    Thanks!

    Hi,
    You cannot use jsp tags inside a uix page.
    However, you can import the content of another JSP from within a UIX file.
    see:
    http://otn.oracle.com/jdeveloper/help/topic?inOHW=true&linkHelp=false&file=jar%3Afile%3A/u01/app/oracle/product/IAS904/j2ee/OC4J_ohw/applications/jdeveloper/jdeveloper/helpsets/jdeveloper/uixref.jar!/ui/servletInclude.html

  • Error in  TLD(jsp custom tags)

    Hi frinend
    iam trying jsp custom tabs (taglibs)
    i worte a java class
    i worte a jsp page
    i worte a TLd file
    the proble with tlb
    it geting error like this
    org.apache.jasper.JasperException: XML parsing error on file /WEB-INF/jsp/mytaglib.tld: (line 2, col -1): XML declaration may only begin entities.
    what is that mean
    i wrote in tld file 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 ">
    <!-- a tag library descriptor -->
    <taglib>
    <tlibversion>1.0</tlibversion>
    <jspversion>1.1</jspversion>
    <shortname>first</shortname>
    <uri></uri>
    <info>A simple tab library for the
    examples</info>
    <tag>
    <name>hello</name>
    <tagclass>tags.HelloTag</tagclass>
    <bodycontent>empty</bodycontent>
    <info>Say Hi</info>
    </tag>
    </taglib>
    pls help
    regards
    kedar

    try something that looks like this in your tld file:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
    "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
    <taglib>
    <tlib-version>1.2</tlib-version>
    <jsp-version>1.2</jsp-version>
    <short-name>MyFirstTag</short-name>
    <tag>
    <name>helloparam</name>
    <tag-class>tags.HyperTag</tag-class>
    <body-content>empty</body-content>
    <attribute>
    <name>name</name>
    <required>false</required>
    <rtexprvalue>false</rtexprvalue>
    </attribute>
    </tag>
    </taglib>

Maybe you are looking for

  • Displaying on projector

    I am having an issue displaying through a projector. I'm using a MacBook running 10.4.11 and have no issue using my mini-DVI to VGA adapter to project through portable projectors @ work. My trouble is displaying through our ceiling mounted project wi

  • How to reduce size of a huge table in Access

    We have an Access mdb file that is getting too large.  It is about 1.7 GB, and will probably hit 2.0 GB in two or three months.  It has already been compacted.  There are only two tables, and 99% is from just one of the two tables, which has about 8.

  • Extension Installer in infinite loop

    Hi, I'm trying to use an Extension Installer to install some extra files for my application. I've searched the forum for problems with the Extension Installer and I've seen a few posts, even the same problem I'm having. But none of the suggestions ha

  • Graphics Card Driver Query

    hi i have seem people using the exact card as me when they use 3dmark they seem to have pure hardware accelration but i do not have this . How can i get it to be pure harware as that person with the exact specs is getting over 1000marks more than me.

  • Radio Buttons in Design Studio

    Hi Experts,     Am new to Design Studio, I am middle of creating dashboard. here i have to use radio button which shows Value and Quantity. where as if i select value as  a radio button then my dash board should show only respective Graph and Cross T