Newbie - JSP and TAG library problem

I am trying to execute a JSP program on a server with
jakarta-tomcat-4.1.29.
Here is a program:
<%@ taglib uri="testTagURL" prefix="testTagPrefix" %>
<testTagPrefix:myFirstTag/>
in web.xml I have definition:
<taglib>
<taglib-uri>testTagURL</taglib-uri>
<taglib-location>/WEB-INF/tld/testTag.tld</taglib-location>
</taglib>
I have testTag.tld file located at: /WEB-INF/tld
When I execute my program I am getting:
org.apache.jasper.JasperException: File "/test-jsp/testTagURL" not
found
My question: how come my program is looking for "/test-jsp/testTagURL" and
not for "/WEB-INF/tld/testTag.tld"?
Thanks,
Zalek

means what it says.
If you look in the file WEB-INF/displaytag.tld you'll see it
has a definition for a custom tag, I'm guessing it's called column.
The tld states that this tag has an attribute called "value". ie that
in a jsp file you would write
   <display:column value="SomeSuperValue" /> However the java class that implements that custom tag
does not have a setter method for value. ie. the class
org.displaytag.tags.ColumnTag is missing the method
public void setValue(String value) { .... }

Similar Messages

  • 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

  • Aggressive JSP and TAG file Compilation?

    I get JSP and TAG file compile errors only when I touch and save the file. Isn't there a way to get these to build automatically by the NitroX builder? I'm constantly getting Jasper compile errors at runtime and having problems when I rename/refactor code that is referenced by .tag files.
    Thanks,
    Mike

    Hi,
    Does this happen to all of your JSP files?
    Please check these settings and update the status:
    * Is your project associated with source control or present on local drive?
    * Window > Preferences > Workbench (General > workspace) - Build automatically
    * Project > Properties > Builders
    - Java Builder
    - NitroX AppXRay Builder
    Did the behavior change due to any of the recent modification/upgrade?
    What version of Eclipse & NitroX are you using?
    * Help > About NitroX > Click on Eclipse icon - Version & build id
    * Help > About NitroX > Click on NitroX icon - Version & build id
    Thanks,
    M7 Support

  • 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

  • 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? :/

  • Custom tag library problem

    I created a workspace with two projects in it.
    In the first project I realized a tag library with its deployment descriptor.
    In the second project I realized a .war component with a jsp that uses the tag in the library.
    In the .war deployment descriptor I choosed the library deployment descriptor in the Profile Dependencies page.
    When I deploy my .war (alone or in an .ear) file I properly find the library .jar file in it but in this .jar file there isn't any .class file.
    Where are my tag handlers? If I deploy the tag library alone the .class files are there so I can replace the library .jar file created in the .ear and all works properly.
    I tried creating a third project that include the .war in its .ear, but I cannot include my tag library .jar because it's not listed in the Application Assembly page.
    Thank you
    Andrea Mattioli

    I found the bug! Its in greeting.jsp ...
    Instead of
    <tw:greeting />
    I typed....
    <tw.greeting />
    which resulted in the the custom tag not being called! That was the source of my problem.
    Thanks,
    Joe!

  • Import Tag library problem in JDeveloper 10.1.3.3.0

    I want to have an FCKEditor on a JHeadstart generated page, so I downloaded the FCKFaces jar with the tag library in it.
    When I try to add the FCKFaces tag library to my project, doing just that and not modifying any code, when I run my application after that I get an empty page... No data in the project. This is very confusing because everything works well, no code errors, the fck library is found and auto completion works with the library.
    So when I have the empty page, to view the JHeadstart page again I just have to shut down JDeveloper, go to the project/web-inf/lib directory and delete the FCKFaces jar. When I do that and start up again, the page loads successfully.
    Thanks for the help in advance..

    Thanks for your reply.
    I tried your solution but still the same problem remains.. I don't have a clue what's wrong with the project, everything works well except for that the page's aren't rendered on execution.

  • I want to make a chatroom using jsp, and have some problem, Help!

    I want to build a chatroom using jsp and client using plain html, so i need every client could have a constant connection with the web server and will receive messages realtime. But i got 2 problems.
    First, how can i turn my buffers off so that messages can get to the client the time it is meant to be. I added
    <@page buffer="none">
    but seems that it takes no effect, any tricks here? thx
    Second, I want every user could have a constant conn. with server but i dont want my server to waste resources on those connection that has already been disconnected.so is it possible to stop executing JSP pages once client has diconnected.Since i found that it will throw no exception writing to the client even if the connection is disconnected in JSPs.
    Thanks!!!!!

    By theway, i'm using TOMCat 5.0 as my JSP container.

  • [SOLVED] Arch64, Opera and plugins library problem

    I have Arch64 with Opera 64-bit as default browser. I have succesfully installed 32-bit flashplugin and it works nicely. The only problem is that fonts cannot be read from the flash player context menu and Open File dialog opened from flash player. The problem is that flashplugin tries to load 64-bit GTK from /usr/lib/gtk-2.0/2.10.0/ and it fails. 32-bit version is installed and it's located in /opt/lib32/usr/lib/gtk-2.0/2.10.0/.
    Gtk-WARNING **: /usr/lib/gtk-2.0/2.10.0/engines/libmurrine.so: wrong ELF class: ELFCLASS64
    Gtk-WARNING **: /usr/lib/gtk-2.0/2.10.0/engines/libpixmap.so: wrong ELF class: ELFCLASS64
    Also I have library loading problem with totem-plugin. It cannot find libxul.so and libxpcom.so, but both library files are located in /usr/lib/xulrunner-1.9.0.1/. The plugin loads fine if I create links to both files in /usr/lib/. But that doesn't seem like right solution to me.
    $ ldd libtotem-mully-plugin.so
    libglib-2.0.so.0 => /usr/lib/libglib-2.0.so.0 (0x00007f94e19d9000)
    libtotem-plparser-mini.so.10 => /usr/lib/libtotem-plparser-mini.so.10 (0x00007f94e17d6000)
    libxul.so => not found
    libxpcom.so => not found
    libplds4.so => /usr/lib/libplds4.so (0x00007f94e15d2000)
    What would be a most elegant way of solving these two library loading problems?
    I think that symbolic links and moving files are not the most elegant way to solve the problem. Maybe some environment variable or some configuration setting would solve the problem (LDPATH comes to mind, but it seems that it doesn't work).
    EDIT: I wasn't sure in which section to post this question, so feel free to move it if necessary.
    Last edited by SnapShot (2008-09-12 02:50:01)

    I have solved my problem and I will post my solution because it can be usefull to others.
    First the problem with flashplugin and GTK library path. Opera uses operapluginwrapper scirpt to detect if the plugin is 32-bit or 64-bit and after detection it uses operapluiginwrapper-ia32-linux for 32-bit or operapluginwrapper-native for 64-bit plugins. operapluiginwrapper-ia32-linux loads the 32-bit flashplugin in my case which requires GTK, but it incorectly tries to load it form /usr/lib/gtk-2.0/ where 64-bit version of GTK resides.
    The solution is to set the GTK_PATH environment variable to point to /opt/lib32/usr/lib/gtk-2.0/ where 32-bit version resides. But if you set it globaly it will result in problems with other 64-bit applications. So the correct solution is to add following lines on the bottom of the operapluginwrapper script above the exec line:
    case "$wrapper" in
    *ia32*)
    export GTK_PATH="/opt/lib32/usr/lib/gtk-2.0"
    export PANGO_RC_FILE="/opt/lib32/config/pango/pangorc"
    esac
    In this way the 32-bit paths will be active only for operapluginwrapper-ia32-linux process.
    I have solved the other problem with totem-plugin requesting libxul.so and libxpcom.so, but the solution idoesn't matter because, although totem-plugin loads coreclty it doesn't work in opera. I have installed mplayer-plugin which works as it should. Also gecko-mediaplayer works correctly with opera, I have tested them both. Install one of the two plugins that work, and you will be fine.

  • JSP Custom tag uri problem

    I'm using custom tags in my app (JSP 1.2). My tld is located in WEB-INF/tlds (not packaged in a JAR), meaning that the uri in the tld file should be picked up by JSP 1.2's autodiscovery. This works fine in actual deployment, but Nitrox claims that:
    "The tag library uri "mytaglib" cannot be mapped to an existing tld file. "
    when I attempt to reference it as follows from within my jsps:
    <%@ taglib uri="mytaglib" prefix="m" %>
    Do you know if this is a bug, or have any suggestions as to why the tld uri isn't being picked up by Nitrox?
    Thanks,
    John

    This is a known (kind of) issue. There are 2 easy workarounds:
    1- Specify the path to the tld file in the uri attribute. For example:
    <%@ taglib uri="/WEB-INF/mytaglib.tld" prefix="m" %>
    2- Map the tld file in web.xml. For example:
    <taglib>
    <taglib-uri>mytaglib</taglib-uri>
    <taglib-location>/WEB-INF/mytaglib.tld</taglib-location>
    </taglib>
    M7 Support

  • Jsp and image cache problem

    Hello,
    In a jsp(running on tomcat) I switch two jpg files(1.jpg and 2.jpg) and redirect to the page that displays them.
    The problem is that the files are really changed, but the page which displayed them needs manual refresh to "know" they are inter-changed.
    What I have tried, but no success:
    1) In the page which displayed them, I have tried to setup header:
    response.setHeader("cache-control","no-cache, no-store,must-revalidate, max-age=-1");
    response.setHeader("pragma","no-cache, no-store");
    response.setDateHeader ("expires", -1);no difference, in both IE(6 and 7) and Firefox 2.
    Also no result with html:
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="Expires" content="-1">2) I have tried to a add a fake param on the images, like
    <a href="1.jpg?<%=(new java.util.Date()).getTime() %">3) I have tried to add also a fake(time) parameter on the jsp which displayes the images, no result
    How can I force the browser to know that I have inter-changed the images?
    Any idea?
    Thank you.</a>

    to traja47 : could you be more specific about that post? Since there are 30,000 plus post about jsp and my sql, thank you very much.
    to jSweep :
    No exceptions.
    just when i ran it, the page is all empty, then I used the VIEW-SOURCE of IE to see the source of the result page, it showed:
    <html>
    <head>
    <title>Accessing data in a database</title>
    </head>
    <body>
    </body>
    </html>
    all the parts related to java are gone. don't know why.

  • JSP and package deployment problem in Tomcat 5

    Hi,
    I tried very simple exercise that includes JSP and javabean (from package), but I have the following error:
    HTTP Status 500 -
    type Exception report
    message
    description The server encountered an internal error ()
    that prevented it from fulfilling this request.
    exception
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: -1 in the jsp file: null
    Generated servlet error:
    [javac] Compiling 1 source file
    [javac] C:\jwsdp\work\Catalina\localhost\exercises\org\apache\jsp\ex01\ex01_jsp.java:10:
    package pack01 does not exist
    [javac] import pack01.ex01;
    [javac] ^
    Bellow are all my sources
    1. directory structure
    ========================
    C:\jwsdp\webapps\exercises
    index.html
    C:\jwsdp\webapps\exercises\ex01
    build.bat
    ex01.jsp
    C:\jwsdp\webapps\exercises\ex01\WEB-INF
    web.xml
    C:\jwsdp\webapps\exercises\ex01\WEB-INF\classes
    C:\jwsdp\webapps\exercises\ex01\WEB-INF\classes\pack01
    ex01.class
    ex01.java
    C:\jwsdp\webapps\exercises\ex01\WEB-INF\lib
    pack01.jar
    2. sources
    ==========
    << ex01.jsp >>
    <HTML> <HEAD> <TITLE>Ex01</TITLE> </HEAD>
    <BODY>
    <FORM METHOD="GET" ACTION="ex01.jsp">
    <%@ page import = "pack01.ex01" %>
    <H2>Ex01</H2>
    <jsp:useBean id = "x" class = "ex01" scope="application"/>
    </FORM>
    </BODY> </HTML>
    << ex01.java >>
    package pack01;
    import java.io.*;
    public class ex01 implements Serializable {
    private String value;
    public ex01() {
    value = "EX01";
    public void setValue(String s) {
    value = s;
    public String getValue() {
    return value;
    << build.bat >>
    cd WEB-INF\classes\
    cd
    del ex01.jar
    javac -deprecation -verbose pack01\ex01.java
    jar cvf ..\lib\pack01.jar pack01\ex01.class
    << C:\jwsdp\webapps\exercises.xml >>
    <Context className="org.apache.catalina.core.StandardContext"
         cachingAllowed="true"
         charsetMapperClass="org.apache.catalina.util.CharsetMapper"
         configFile="webapps\exercises.xml"
         cookies="true"
         crossContext="false"
         debug="0"
         displayName="Exercises"
         docBase="C:\jwsdp\webapps\exercises"
         domain="Catalina"
         engineName="Catalina"
         j2EEApplication="none"
         j2EEServer="none"
         lazy="true"
         mapperClass="org.apache.catalina.core.StandardContextMapper"
         path="/exercises"
         privileged="false"
         reloadable="true"
         startupTime="30"
         swallowOutput="true"
         useNaming="true"
         wrapperClass="org.apache.catalina.core.StandardWrapper" >
    </Context>
    What is wrong ?
    I have Windows NT and Tomcat 5 (from jwsdp 1.2).
    Thank you,
    Alex.

    I just tried to reproduce the problem with old version of Tomcat (4.0.2) and ... it works. It is definitely specific for Tomcat 5 (or may be one of the late Tomcat 4 as well). There is another related difference:
    With Tomcat 4 I could create javabean in class subdirectory (default package) and use
    <%@ page import="ex01" %>
    Now with Tomcat 5 I have syntax error in this line.
    This syntax error disappeared when I moved javabean into package pack01.

  • I can't connect to MySQL database from The JSP Standard Tag Library

    Hi All !
    I have a problem, please help me anybody !
    I don't connect to MySQL database from jsp page using JSTL tag but from servlet all work correctly. I set my path and put �mysql-connector-java-3.1.13-bin.jar� in ENVIRONMENT WinXP(classpath=C:\Java\jdk1.5.0_10\jre\lib\ext\mysql-connector-java-3.1.13-bin.jar) and in War project folder �WEB-INF/lib� and in [TomcatServer]\common\lib.
    I have in folder�WEB-INF/lib� following files:
    antlr.jar
    commons-beanutils.jar
    commons-collections.jar
    commons-digester.jar
    commons-fileupload.jar
    commons-logging.jar
    commons-validator.jar
    jakarta-oro.jar
    jsf-api.jar
    jsf-impl.jar
    jstl.jar
    mysql-connector-java-3.1.13-bin.jar
    standard.jar
    struts.jar
    I'm using:
    NetBeans 5.5 Build200610171010 (bundled Tomcat 5.5.17)
    Ent.Pack 20061020 Visual Wb Pack 061103
    OS WinXP SP2
    Java 1.5.0_10
    MySQL 5.0.18-nt
    1:<%@page contentType="text/html"%>
    2:<%@page pageEncoding="UTF-8"%>
    8: <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
    9: <%@taglib uri="http://java.sun.com/jstl/sql" prefix="sql"%>
    10:
    11: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    12: "http://www.w3.org/TR/html4/loose.dtd">
    13:
    14: <sql:setDataSource var="ds"
    15: driver="com.mysql.jdbc.Driver"
    16: url="jdbc:mysql://localhost:3306/test"
    17: user="root"
    18: password="xxxx"/>
    19:
    20:
    21:<sql:query sql="select name, age from People" var="res"
    22: dataSource="${ds}"/>
    I have received report on mistake when entered code at the top:
    �/index.jsp [21;0] According to TLD or attribute directive in tag file, attribute dataSource does not accept any expressions�
    I used instead of (dataSource="${ds}")->(dataSource="ds") but this did not work.
    After build and run I have received
    =========================================START=================================
    HTTP Status 500
    type Exception report:
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    org.apache.jasper.JasperException: /index.jsp(21,0) According to TLD or attribute directive in tag file, attribute dataSource does not accept any expressions
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)
    root cause
    org.apache.jasper.JasperException: /index.jsp(21,0) According to TLD or attribute directive in tag file, attribute dataSource does not accept any expressions
    org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
    org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:405)
    org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:146)
    org.apache.jasper.compiler.Validator$ValidateVisitor.checkXmlAttributes(Validator.java:955)
    org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:710)
    org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1441)
    org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
    org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2213)
    org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2219)
    org.apache.jasper.compiler.Node$Root.accept(Node.java:456)
    org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
    org.apache.jasper.compiler.Validator.validate(Validator.java:1489)
    org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:166)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:295)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:276)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:264)
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:303)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)
    note The full stack trace of the root cause is available in the Apache Tomcat/5.5.17 logs.
    Apache Tomcat/5.5.17
    =======================================END================================
    Error: "According to TLD or attribute directive in tag file, attribute dataSource does not accept any expressions" - but according to documentation such parameter possible.
    BUT WHEN JOINING With DATABASE FROM SERVLET ALL WORK FINE.
    I read this doc - [http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html], this applicable if I Tomcat Admin, but i'am not Admin
    I simply user, i.e. I want to place its database on virtual host (Tomcat+(JSP-JSTL)+MySQL).
    There is idea how can resolve this problem
    Thank you in advance ;)

    For all how have similar problem.
    Decision instead of these ways
    <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
    <%@ taglib prefix="sql" uri="http://java.sun.com/jstl/sql" %>
    it is necessary to indicate these
    <%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

  • Jsp & custom tag buffer problem

    Hi all,
    I have a tag that reads one of the txt file and renders the output on the JSP.
    The problem is, when I refresh the same page in it duplicates the output and append it to the previous output every time (mostly).
    I know there is no that there is no exception occurred, bcoz i have checked the log files. I am using tomcat 5.5.9
    I tired to use out.flush() but it gave me same thing.
    Any help would be appreciated.
    Thank you.
    The code:
    JspWriter out = pageContext.getOut();
    URL header = new URL(url);
    BufferedReader in = new BufferedReader
    (new InputStreamReader(header.openStream()));
    String inputLine;
    while ((inputLine = in.readLine()) != null){
    System.out.println(inputLine);
    fileContent = fileContent + inputLine;
    in.close();
    out.print(fileContent);
    out.flush();

    code_box wrote:
    You are genius. Tell that to the forum elite! Seriously, it's just a matter of practice. I've been using Java since 1998 so I better be able to spot that!
    A very basic mistake from me and you spotted it right away...As you get more experience you'll spot them esaily yourself, but as you write more and more complex code, the mistakes you DO make will be much harder to figure out. :)
    Thanks a lot. It resolved the problem.
    Cheers mate,
    /md.Any time. Good luck!

  • JSP and Servlet compilation problem

    I am getting strange errors whilst compiling this simple-tag class for JSP. I know I need to install the Java Servlet API.
    I have been to the sun website and downloaded something called:
    JavaTM Technology & Web Services
    Java Web Services Developer Pack Download
    It was an .exe program, it found my installation of j2se (or jdk).
    Is there anything else I need to do? Or have I downloaded the wrong file?
    Here is the class:
    import javax.servlet.jsp.*;
    import javax.servlet.jsp.tagext.*;
    public class SimpleTag extends javac.seervlet.jsp.tagext.TagSupport
    public int doStartTag() throws JspExcption
         try
    pageContext.getOut().print("Welcome to my Web site.");
    catch (Exception e)
    throw new JspTagExcpetion(e.getMessage() );
    return SKIP_BODY;
    Here is the errors:
    public class SimpleTag extends javac.seervlet.jsp.tagext.TagSupport
    ^
    SimpleTag.java:6: cannot resolve symbol
    symbol : class JspExcption
    location: class SimpleTag
    public int doStartTag() throws JspExcption
    ^
    SimpleTag.java:10: cannot resolve symbol
    symbol : variable pageContext
    location: class SimpleTag
    pageContext.getOut().print("Welcome to my Web site.");
    ^
    SimpleTag.java:14: cannot resolve symbol
    symbol : class JspTagExcpetion
    location: class SimpleTag
    throw new JspTagExcpetion(e.getMessage() );
    ^
    SimpleTag.java:16: cannot resolve symbol
    symbol : variable SKIP_BODY
    location: class SimpleTag
    return SKIP_BODY;
    ^
    7 errors

    Okay I have made the changes but still gives me the same error message for servlets.
    import javax.servlet.jsp.*;
    import javax.servlet.jsp.tagext.*;
    public class SimpleTag extends javax.servlet.jsp.tagext.TagSupport
    public int doStartTag() throws JspException
         try
    pageContext.getOut().print("Welcome to my Web site.");
    catch (Exception e)
    throw new JspTagException(e.getMessage() );
    return SKIP_BODY;
    Still get the same errors:
    public class SimpleTag extends javax.servlet.jsp.tagext.TagSupp
    ^
    SimpleTag.java:6: cannot resolve symbol
    symbol : class JspException
    location: class SimpleTag
    public int doStartTag() throws JspException
    ^
    SimpleTag.java:10: cannot resolve symbol
    symbol : variable pageContext
    location: class SimpleTag
    pageContext.getOut().print("Welcome to my Web site."
    ^
    SimpleTag.java:14: cannot resolve symbol
    symbol : class JspTagException
    location: class SimpleTag
    throw new JspTagException(e.getMessage() );
    ^
    SimpleTag.java:16: cannot resolve symbol
    symbol : variable SKIP_BODY
    location: class SimpleTag
    return SKIP_BODY;
    ^
    7 errors

Maybe you are looking for