Initial problem with JSP Custom Tag devolopment

Hi ,
I have encountered a problem with my JSP application which utilizes a simple custom tag.
First I created followinng directories.
1. %TOMCAT_HOME%\webapps\testTags
2. %TOMCAT_HOME%\webapps\testTags\META-INF
3. %TOMCAT_HOME%\webapps\testTags\WEB-INF
4. %TOMCAT_HOME%\webapps\testTags\WEB-INF\tlds
5. %TOMCAT_HOME%\webapps\testTags\WEB-INF\classes
6. %TOMCAT_HOME%\webapps\testTags\WEB-INF\classes\com
7. %TOMCAT_HOME%\webapps\testTags\WEB-INF\classes\com\tek271
8. %TOMCAT_HOME%\webapps\testTags\WEB-INF\classes\com\tek271\testTags
I created the essential four files, that is named as follows.
1.TagError.java
2.web.xml
3.testTld.tld
4.testJsp.jsp
Then i put the files under these directories as given below
testJsp.jsp under %TOMCAT_HOME%\webapps\testTags.
web.xml under %TOMCAT_HOME%\webapps\testTags\WEB-INF
TagError.java under %TOMCAT_HOME%\webapps\testTags\WEB-INF\classes
TagError.class under %TOMCAT_HOME%\webapps\testTags\WEB-INF\classes\com\tek271\testTags
testTld.tld %TOMCAT_HOME%\webapps\testTags\WEB-INF\tlds
Here is the content inside the files.
1.TagError.java
package com.tek271.testTags;
import java.io.*;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
public class TagError extends TagSupport {
private String mColor = "red";
public void setColor(String aColor) {
mColor = aColor;
} // setColor
public int doStartTag() throws JspException {
try {
JspWriter out = pageContext.getOut();
out.print("<font color=\"");
out.print(mColor);
out.print("\"><b>Error: ");
} catch (IOException ex) {
throw new JspTagException(ex.getMessage());
return EVAL_BODY_INCLUDE; // other return: SKIP_BODY
} // doStartTag()
public int doEndTag() throws JspException {
try {
JspWriter out = pageContext.getOut();
out.println("</b></font><br>");
} catch (IOException ex) {
throw new JspTagException(ex.getMessage());
return EVAL_PAGE; // other return: SKIP_PAGE
} // doEndTag()
} // TagError
2.web.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app>
<taglib>
<taglib-uri>/testTaglib</taglib-uri>
<taglib-location>/WEB-INF/tlds/testTld.tld</taglib-location>
</taglib>
</web-app>
3.testTld.tld
<?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>testTld</shortname>
<info>Testing jsp tags</info>
<tag>
<name>tagError</name>
<tagclass>com.tek271.testTags.TagError</tagclass>
<bodycontent>JSP</bodycontent> <!-- Also: empty, tagdependent -->
<info>Show a string as an error message</info>
<attribute>
<name>color</name>
<required>false</required>
</attribute>
</tag>
</taglib>
4.testJsp.jsp
<%@ taglib uri="/testTaglib" prefix="test" %>
<html>
<head>
<title>Testing Tag Library</title>
</head>
<body>
<test:tagError>Invalid user name</test:tagError>
<test:tagError color="blue">Invalid Password</test:tagError>
</body>
</html>
but i am getting the following error.
Apache Tomcat/4.0.3 - HTTP Status 500 - Internal Server Error
type Exception report
message Internal Server Error
description The server encountered an internal error (Internal Server Error) that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: File "/testTaglib" not found
at org.apache.jasper.compiler.TagLibraryInfoImpl.(TagLibraryInfoImpl.java:214)
at org.apache.jasper.compiler.TagLibraryInfoImpl.(TagLibraryInfoImpl.java:174)
at org.apache.jasper.compiler.JspParseEventListener.processTaglibDirective(JspParseEventListener.java:1162)
at org.apache.jasper.compiler.JspParseEventListener.handleDirective(JspParseEventListener.java:758)
at org.apache.jasper.compiler.DelegatingListener.handleDirective(DelegatingListener.java:121)
at org.apache.jasper.compiler.Parser$Directive.accept(Parser.java:255)
at org.apache.jasper.compiler.Parser.parse(Parser.java:1145)
at org.apache.jasper.compiler.Parser.parse(Parser.java:1103)
at org.apache.jasper.compiler.Parser.parse(Parser.java:1099)
at org.apache.jasper.compiler.ParserController.parse(ParserController.java:213)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:210)
at org.apache.jasper.servlet.JspServlet.loadJSP(JspServlet.java:552)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:177)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:189)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:382)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:474)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2343)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1012)
at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1107)
at java.lang.Thread.run(Thread.java:536)
why is it like this ?please give me a solution.
Thanking in advance.
From
Vinod A.

Dear patreck ,
It does not work.
I have replaced the line
<%@ taglib uri="/testTaglib" prefix="test" %>
with
<%@ taglib uri="WEB-INF/tlds/testTaglib" prefix="test" %>
but now it shows the error ,
description The server encountered an internal error (Internal Server Error) that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: File "/testTags/WEB-INF/tlds/testTaglib" not found
any more suggestion ?
From Vinod A.

Similar Messages

  • How to call a method repeatedly with JSP custom tag?

    This senerio is very similar to the usage of StringBuffer.
    I have a problem which can be solved easily with scriptlets:
    <% NameValuePair nvp = new NameValuePair(request.getQueryString()); %>
    <a href="foo.html?<%=nvp.add(name1", "value1").add("name2", "value2").toString();%">">Foo</a>
    <a href="bar.html?<%=new NameValuePair(request.getQueryString()).add("x", 1).add("y", 2).toString()%>">Bar</a>
    But I cannot use scriplets because it's turned off. I can only use jsp custom tag / jstl. How would I implement this functionality with a custom tag? How would the JSP code look like? Our container supports JSP 2.0.
    Thanks.</a>

    hi,
    you can do within 2 step-
    1) use <%@page import="your_java_class"%>
    2)use scriptlet code <%...%> and write coding in this tag.
    means create instance of your java class .
    <% your_java_class obj1=new your_java_class();
         obj1.method_of_your_java_class();
    %>or
    3) you can make javabean to use method of java class.[Best option]
    Thanx
    Ranvijay

  • Database access with JSP custom tags

    i have created one file in which i am making the connection with mysql data base with con.mysql.jdbc.Driver.and usking J connector and that i'm doing with custom tag.this is the error which i'm getting in tomcat.
    and the tag handler class and TLD file and jsp file is below
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    javax.servlet.ServletException: javax.servlet.jsp.JspException: null
    org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl .java:841)
    org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.j ava:778)
    org.apache.jsp.DbTry_jsp._jspService(org.apache.jsp.DbTry_jsp:72)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:325)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    root cause
    java.lang.NullPointerException
    Try.Connect.<init>(Connect.java:26)
    sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    java.lang.reflect.Constructor.newInstance(Unknown Source)
    java.lang.Class.newInstance0(Unknown Source)
    java.lang.Class.newInstance(Unknown Source)
    org.apache.jasper.runtime.TagHandlerPool.get(TagHandlerPool.java:116)
    org.apache.jsp.DbTry_jsp._jspx_meth_db_connect_0(org.apache.jsp.DbTry_jsp:84)
    org.apache.jsp.DbTry_jsp._jspService(org.apache.jsp.DbTry_jsp:62)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:325)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    note The full stack trace of the root cause is available in the Apache Tomcat/5.5.4 logs.
    Apache Tomcat/5.5.4
    Tag handler class
    package Try;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    import javax.servlet.jsp.JspException;
    import javax.servlet.jsp.JspWriter;
    import javax.servlet.jsp.PageContext;
    import javax.servlet.jsp.tagext.TagSupport;
    import java.sql.*;
    public class Connect extends TagSupport {
    private String driver = "com.mysql.jdbc.Driver";
    private String dbtype = "mysql";
    private String host = "localhost";
    private String username = "root";
    private String password = "203131";
    private String database = "compose";
    private String scope = "page";
    private String id = "";
    JspWriter out = pageContext.getOut();
    public void setDriver(String str) {
    driver = str;
    public void setDbtype(String str) {
    dbtype = str;
    public void setHost(String str) {
    host = str;
    public void setUsername(String str) {
    username = str;
    public void setPassword(String str) {
    password = str;
    public void setDatabase(String str) {
    database = str;
    public void setScope(String str) {
    scope = str;
    public void setId(String str) {
    id = str;
    public int doStartTag() throws JspException {
    try {
    Class.forName("com.mysql.jdbc.Driver");
    String url= "jdbc:" + dbtype + "://" + host + "/" + database;
    Connection connection = DriverManager.getConnection(url,username,password);
    out.println("right ;;one");
    catch (SQLException e1) {
    System.out.println("Error in HeadingTagv: " + e1);
    catch (Exception e) {
    System.out.println("Error in HeadingTag: " + e);
    return SKIP_BODY;
    TLD is lib.tld
    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE taglib
    PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
    "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_2.dtd">
    <taglib>
    <tlib-version>1.0</tlib-version>
    <jsp-version>1.2</jsp-version>
    <short-name>db</short-name>
    <display-name>Database Tags</display-name>
    <description>
    A set of tags for working with SQL database access
    </description>
    <tag>
    <name>connect</name>
    <tag-class>Try.Connect</tag-class>
    <body-content>empty</body-content>
    <description>
    </description>
    <attribute>
    <name>driver</name>
    <required>false</required>
    <rtexprvalue>true</rtexprvalue>
    <description>
    </description>
    </attribute>
    <attribute>
    <name>dbtype</name>
    <required>false</required>
    <rtexprvalue>true</rtexprvalue>
    <description>
    </description>
    </attribute>
    <attribute>
    <name>host</name>
    <required>false</required>
    <rtexprvalue>true</rtexprvalue>
    <description>
    Can be given by a run-time expression.
    Host name of the computer where database is located.
    Default is "localhost".
    </description>
    </attribute>
    <attribute>
    <name>username</name>
    <required>false</required>
    <rtexprvalue>true</rtexprvalue>
    <description>
    Can be given by a run-time expression.
    Username for logging onto the database.
    Default is "root".
    </description>
    </attribute>
    <attribute>
    <name>password</name>
    <required>false</required>
    <rtexprvalue>true</rtexprvalue>
    <description>
    Can be given by a run-time expression.
    Password for logging onto the database.
    Default is the empty string.
    </description>
    </attribute>
    <attribute>
    <name>database</name>
    <required>false</required>
    <rtexprvalue>true</rtexprvalue>
    <description>
    Can be given by a run-time expression.
    The name of the database that will be used for
    the SQL commands. Default is no database specified.
    </description>
    </attribute>
    <attribute>
    <name>id</name>
    <required>false</required>
    <description>
    </description>
    </attribute>
    <attribute>
    <name>scope</name>
    <required>false</required>
    <description>
    </description>
    </attribute>
    </tag>
    </taglib>
    JSP file is
    <%@ taglib uri="/WEB-INF/lib.tld" prefix="db" %>
    <html>
    <body>
    <db:connect username="root" password="203131" database="compose" />
    </body>
    </html>

    Answered in your other post:
    http://forum.java.sun.com/thread.jspa?threadID=608780&tstart=0

  • Problems with JSP and Tag Libraries in JBoss using Tomcat 5.5.9

    Hi,
    I am experiencing a really weird situation here. When running a deployed EJB3 ear application in a JBoss 4.0.3sp1 application using Tomcat service 5.5.9, Jasper is unable to compile any JSP file using Tag Libraries. To be more precise, when generating the Java source file (looking in the 'work' directory) everything in the file after the first occurance of a Tag Library usage is commented out (with "//"), causing the Java source to be invalid and outputs an error when accessing the page via a browser saying:
    "org.apache.jasper.JasperException: Unable to compile class for JSP
    Generated servlet error:
    Syntax error, insert "}" to complete ClassBody
    Generated servlet error:
    Syntax error, insert "}" to complete Block
    Generated servlet error:
    Syntax error, insert "finally" to complete TryStatement
    Generated servlet error:
    Syntax error, insert "}" to complete MethodBody"
    etc... where every error row is a suggestion of steps to take to make the source file valid. (of course).
    The Tag Library jar files are located in the web application WEB-INF/lib folder as they should be. The descriptive Tag Library Definition files (tld:s) are located in the WEB-INF folder and every JSP file references these tld files directly via this path (WEB-INF/).
    Any hints are most appreciated!!
    Cheers!
    /Henrik

    Hi,
    I am experiencing a really weird situation here. When running a deployed EJB3 ear application in a JBoss 4.0.3sp1 application using Tomcat service 5.5.9, Jasper is unable to compile any JSP file using Tag Libraries. To be more precise, when generating the Java source file (looking in the 'work' directory) everything in the file after the first occurance of a Tag Library usage is commented out (with "//"), causing the Java source to be invalid and outputs an error when accessing the page via a browser saying:
    "org.apache.jasper.JasperException: Unable to compile class for JSP
    Generated servlet error:
    Syntax error, insert "}" to complete ClassBody
    Generated servlet error:
    Syntax error, insert "}" to complete Block
    Generated servlet error:
    Syntax error, insert "finally" to complete TryStatement
    Generated servlet error:
    Syntax error, insert "}" to complete MethodBody"
    etc... where every error row is a suggestion of steps to take to make the source file valid. (of course).
    The Tag Library jar files are located in the web application WEB-INF/lib folder as they should be. The descriptive Tag Library Definition files (tld:s) are located in the WEB-INF folder and every JSP file references these tld files directly via this path (WEB-INF/).
    Any hints are most appreciated!!
    Cheers!
    /Henrik

  • Problem with a custom tag using Jasper Report

    Hi everybody, I'm deprived of hope,
    I wrote this code for a custom taglib to convert a .jasper file into a .pdf file:
    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()
    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());
    //Creazione del PDF
    JasperExportManager.exportReportToPdfFile(jasperPrint, destinationFileName);
    System.exit(0);
    catch(Exception e)
    { e.printStackTrace();}
    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;
    No errors while compile but in execution I have this message:
    javax.servlet.ServletException: net/sf/jasperreports/engine/JasperFillManager
    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:80)
    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.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    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
    java.lang.NoClassDefFoundError: net/sf/jasperreports/engine/JasperFillManager
    com.tag.GeneratePDF.doEndTag(GeneratePDF.java:49)
    org.apache.jsp.reportPDF_jsp._jspx_meth_JR_GeneratePDF_0(reportPDF_jsp.java:97)
    org.apache.jsp.reportPDF_jsp._jspService(reportPDF_jsp.java:68)
    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.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    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)
    Please HELP ME !!!!!!!!!
    Thank you in advance
    AleX

    Do you have the Jasper classes in /WEB-INF/lib?

  • Problems with JSP - using tag library with Weblogic 8.1

    I am getting the following error when I try to run a web application called "regain":
    /searchinput.jsp(2): Error in using tag library uri='regain-search.tld' prefix='search': cannot find tag class: 'net.sf.regain.ui.server.taglib.MsgTag'
    probably occurred due to an error in /searchinput.jsp line 2:
    <%@taglib uri="regain-search.tld" prefix="search" %>
    The classes that the .tld file points to are in the web applications WEB-INF/classes directory and I have put this path into my classpath environment variable (running Windows 2000 Server).
    This application runs fine on Tomcat.
    I can't not figure out whether is error is masking another error or what. I've tried using JDK and Jrockit for my web app - no luck.
    Please help! Thanks!

    anyone? :/

  • Problems with parameterized custom tags - urgent

    Hi All,
    I am not able to retrieve my attribute values in Tag Support Class?
    it doesn't give any errors while compiling and also the tag works without those attributes. I am able to print some html using the same tag but not able to print the passed attribute values?
    any help is highly appreciated!
    Thank You.....:-)

    Thanks for the response!
    Infact I figured it out and made it working but still it's a question to me.
    Change I have made in my .tld file is making rtexprvalue to true - "<rtexprvalue>true</rtexprvalue>".
    As per documentation it should matter but bcoz of this setting to false I was not able to retrieve.
    Anyways Thanks again & Have a Good Day.....:-)

  • 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

  • JSP Custom Tag and Expressions for parameters

    This should be an easy question. I am trying to use an expression for a
              parameter to a jsp or custom jsp tag. When I hard code a value for the
              parameter, the tag works fine but when I use the expression, the expression
              gets evaluated but the tag itself does not resulting in the tag being shown
              in my output.
              For example:
              <jsp:forward page="www.slashdot.org"/> works
              <jsp:forward page="<%=request.getParameter("DESTINATION")%>"/>
              places the following into my html output
              <jsp:forward page="www.slashdot.org"/>
              Can someone please tell me what I am doing wrong or at least offer some
              debugging hints?
              Thanks in advance!
              Jacob Meushaw
              

    I have experienced almost this exact same problem, but with a custom
              tag. And I did make sure that my attribute specified
              <rtexprvalue>true</rtexprvalue>. Here is the weird part.
              If I do the following JSP code everything works fine:
              <% String foo = request.getParameter("bar"); %>
              <mytag:custom param="<%= foo %>"/>
              But if I do this:
              <mytag:custom param="<%= request.getParameter("bar") %>"/>
              I get the following in my html output:
              <mytag:custom param="whatever bar is set to in the request"/>
              It appears that the JSP container only does a one pass evaluation.
              Is this the spec of is this a bug?
              Jacob Meushaw wrote:
              >
              > This should be an easy question. I am trying to use an expression for a
              > parameter to a jsp or custom jsp tag. When I hard code a value for the
              > parameter, the tag works fine but when I use the expression, the expression
              > gets evaluated but the tag itself does not resulting in the tag being shown
              > in my output.
              >
              > For example:
              >
              > <jsp:forward page="www.slashdot.org"/> works
              >
              > <jsp:forward page="<%=request.getParameter("DESTINATION")%>"/>
              > places the following into my html output
              > <jsp:forward page="www.slashdot.org"/>
              >
              > Can someone please tell me what I am doing wrong or at least offer some
              > debugging hints?
              >
              > Thanks in advance!
              >
              > --
              > Jacob Meushaw
              Jeff Smith
              [email protected]
              BEA Systems, Inc.
              720-565-6613
              

  • Rendering A JPEG image with a custom tag

    Hi All,
    I have dilema. I'm trying to rendering a jpeg in IE/FireFox with a custom tag that I developed. I'm able to access the bean and invoke the getter method to return the InputStream property. But what gets rendered is the byte code not the image. I've tried just about anything I could think off. If any body has an answer I would difinitely appreciate it.
    Thanks,
    Tony
    Below is the jsp, tld, bean and tag.
    ********************************* image.jsp ****************************************
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <%@ taglib uri="/WEB-INF/custom-chtml.tld" prefix="chtml" %>
    <html>
    <head>
    <title>HTML Page</title>
    </head>
    <body bgcolor="#FFFFFF">
    <chtml:img name="photo" property="file"/>
    </body>
    </html>
    ********************************* custom-chtml.tld **********************************
    <?xml version="1.0" encoding="UTF-8"?>
    <!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>chtml</shortname>
    <tag>
    <name>img</name>
    <tagclass>com.struts.taglib.CustomImgTag</tagclass>
    <bodycontent>empty</bodycontent>
    <attribute>
    <name>name</name>
    <required>false</required>
    <rtexprvalue>true</rtexprvalue>
    </attribute>
    <attribute>
    <name>property</name>
    <required>true</required>
    <rtexprvalue>true</rtexprvalue>
    </attribute>
    </tag>
    </taglib>
    **************************** MemberPhotoBean.java ******************************
    import java.io.InputStream;
    * @author tony
    * TODO To change the template for this generated type comment go to
    * Window - Preferences - Java - Code Style - Code Templates
    public class MemberPhotoValue {
         private String memberId;
         private int fileSize;
         private InputStream file;
         public MemberPhotoValue() {
         public MemberPhotoValue(String memberId, InputStream file) {
              this.memberId = memberId;
              this.file = file;
         public MemberPhotoValue(String memberId,int fileSize,InputStream file) {
              this.memberId = memberId;
              this.fileSize = fileSize;
              this.file = file;          
         public String getMemberId(){
              return memberId;
         public void setMemberId(String memberId) {
              this.memberId = memberId;
         public int getFileSize() {
              return fileSize;
         public void setFileSize(int fileSize) {
              this.fileSize = fileSize;
         public InputStream getFile(){
              return file;
         public void setFile(InputStream file) {
              this.file = file;
    *************************** CustomTagHandler.java ********************************
    import java.io.*;
    import javax.imageio.ImageIO;
    import javax.servlet.*;
    import javax.servlet.jsp.*;
    import javax.servlet.jsp.tagext.*;
    import java.lang.reflect.Method;
    import java.lang.reflect.InvocationTargetException;
    import java.awt.image.*;
    import java.awt.*;
    import javax.swing.ImageIcon;
    import com.sun.image.codec.jpeg.*;
    * JSP Tag Handler class
    * @jsp.tag name = "CustomImg"
    * display-name = "Name for CustomImg"
    * description = "Description for CustomImg"
    * body-content = "empty"
    public class CustomImgTag implements Tag {
         private PageContext pageContext;
         private Tag parent;
         private String property;
         private String name;
         private Class bean;
         public int doStartTag() throws JspException {
              return SKIP_BODY;
         public int doEndTag() throws JspException {
         try {
         ServletResponse response = pageContext.getResponse();
         // read in the image from the bean
         InputStream stream = (InputStream) invokeBeanMethod();
         BufferedImage image = ImageIO.read(stream);          Image inImage = new ImageIcon(image).getImage();
         Graphics2D g = image.createGraphics();
         g.drawImage(inImage,null,null);               
         OutputStream out = response.getOutputStream();
    // JPEG-encode the image
    JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
    encoder.encode(image);               
         out.close();     
    } catch (IOException io) {
              throw new JspException(io.getMessage());
         return EVAL_PAGE;
         public void release(){}
    private InputStream invokeBeanMethod() throws JspException {
         try {
         Object bean = null;
         if (null != pageContext.getAttribute(name)) {
         bean = (Object) pageContext.getAttributename);
         else if (null != pageContext.getSession().getAttribute(name)) {
         bean = (Object) pageContext.getSession().getAttribute(name);
         else if (null != pageContext.getRequest().getAttribute(name)) {
         bean = (Object) pageContext.getRequest().getAttribute(name);
         else {
         throw new JspException("Bean : "+name+" is not found in any pe.");
         Class[] parameters = null;
         Object[] obj = null;               
         Method method = bean.getClass().getMethod("getFile",parameters);
         return (InputStream) method.invoke(bean,obj);
         } catch (NoSuchMethodException ne) {
         throw new JspException("No getter method "+property+" for bean : "+bean);
         } catch (IllegalAccessException ie) {
         throw new JspException(ie.getMessage());
         } catch (InvocationTargetException ie) {
         throw new JspException(ie.toString());
         public void setPageContext(PageContext pageContext) {
              this.pageContext = pageContext;
         public void setParent(Tag parent) {
              this.parent = parent;
         public Tag getParent() {
              return parent;
         public void setProperty(String property) {
              this.property = property;
         public void setName(String name) {
              this.name = name;
    **************************************************************************************

    If you have access to an image editing tool such as photoshop, I would advice you import the image into Phototshop and save it in a different format e.g, GIF format and re-import it into Final Cut Express HD. This could solve your rendering problem if all you need is to use a Still image.
    Ayemenre

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

  • Aggressive Caching of JSP Custom Tags?

    I've just developed my first JSP Custom Tag. I compiled my class and it
              worked fine. But subsequent changes to the class source and recompiles
              don't affect the JSP output; evidently, these are aggressively cached, so
              much so that 12 hours later it still won't change (I was hoping it would be
              a 10 minute timeout or something like that.)
              Is this the problem? If so, is there a weblogic.properties setting to tell
              WL to check for modifications to the class file every so often?
              David
              

    Lets say i want to have some user defined exception messages.There
    i will say in tag support or body tag support i will use JSPException
    and throw my customised exception.
    Can any one tell me any practical example.
    If someone really have used it somewhere.
    thanks
    vijendra

  • Problem with InputSelect Data Tag if there is no register in database

    Hello all,
    I4m working with Oracle JDeveloper 3.2.2 and I have a problem with InputSelect Data Tag.
    When I tried to access a JSP page with this object and there was n't a record at the table, an error occurred.

    All the input tags operate on rows in the cache. Prior to using the input tags, use the Row tag with the 'Create' option to make sure you have a valid row.

  • How do I fix a initializing problem with my macbook pro? I only get to the blank screen with the apple logo and the "processing something"sign... it just doesn't start the system....

    How do I fix a initializing problem with my macbook pro? I only get to the blank screen with the apple logo and the "processing something" sign... it just doesn't start the system....
    Please help
    Marcelo

    If there is no loading bar, it's usually a problem with a third party kext file in OS X itself.
    You can press the power button down to force a hardware shutdown, then reboot holding the shift key down on a wired or built in keyboard, this will disable them and you go around and update your third party software.
    Gray, Blue or White screen at boot, w/spinner/progress bar
    Also take this time to backup your users files off the machine if possible.
    Most commonly used backup methods
    Sometime that won't work and you need to do more
    ..Step by Step to fix your Mac

Maybe you are looking for

  • How to break the line in Oracle SQL?

    Hi All, I have a long text with comma separated value. I am storing that in to one custom table as it is. But i want to store that with next line i mean split the comma separated line and insert into the table table with next line or new line charact

  • Error Message on Redirect

    Hi all, I have configured an error page in web.xml when an error occurs - e.g. the file size limit exceeded. This is a plain html page as I have not found a way to use a jsp. Is it possible to give a detail error message? I want an error page similar

  • Last software for ibook g4

    what is the last software for the ibook g4

  • STILL WAITING FOR HELP..... weblink in illustrator/acrobat reader

    hi everybody, (sorry for my bad english - i'm german). i want to put a weblink into an illustrator file. it works with the imagemap (rectangle) when i write a www.test.com or do it with an email link like [email protected] when i save this file to a

  • How to add instance SQL to UCCX 8.0 datasource

    I do success connect to SQL 2005 default instance using JTML URL as jdbc:jtds:sqlserver://192.168.61.199:1433/Cisco; But I coundn't connect to SQL 2005 with instance such as jdbc:jtds:sqlserver://192.168.51.6:1433/imind_ctc_db:INSTANCE=instance_name