Results 1 to 2 of 2
  1. #1
    anchitanc is offline Member
    Join Date
    Oct 2010
    Posts
    44
    Rep Power
    0

    Default Error in EL function

    Hi,

    i am trying to run some EL function. but i am getting this error

    my jsp file is:-
    Java Code:
    <@ taglib perfix="taglib_test" uri="first_tld.tld" %>  
    <html>  
    <body>  
      
    ${taglib_test:test_name()}  
      
    </body>  
    </html>

    and function class in WEB-INF/classes/EL1/test1_class.class:-
    Java Code:
    package El1;  
    public class test1_class  
    {  
        public static int first_fun()  
        {  
            return 10;  
        }  
    }
    and my tld file in (WEB-INF/tags/first_tld.tld) :-

    Java Code:
    <?xml version="1.0" encoding="ISO-8859-1"?>    
        
    <taglib xmlns="http://java.sun.com/xml/ns/j2ee"    
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"    
         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd"    
         version="2.5">    
        
      <tlib-version>2.0</tlib-version>  
      <uri>first_tld.tld</uri>  
      <function>  
        <name>test_name</name>  
        <function-class>EL1.test1_class</function-class>  
        <function-signature>  
        int first_fun()  
        </function-signature>  
       </function>  
    </taglib>
    my web.xml is :-

    Java Code:
    <?xml version="1.0" encoding="ISO-8859-1"?>  
      
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee"  
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
        xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd"  
        version="2.5">  
      
           <taglib>  
            <taglib-uri>  
              first_tld.tld  
            </taglib-uri>  
            <taglib-location>  
               /WEB-INF/tags/first_tld.tld  
            </taglib-location>  
        </taglib>  
       
    </web-app>
    i am getting this error at startup of tomcat:-
    Java Code:
    SEVERE: Begin event threw exception  
    java.lang.IllegalArgumentException: taglib definition not consistent with specif  
    ication version  
            at org.apache.catalina.startup.TaglibLocationRule.begin(WebRuleSet.java:  
    1164)  
            at org.apache.tomcat.util.digester.Digester.startElement(Digester.java:1  
    276)  
            at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startEle  
    ment(Unknown Source)  
            at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImp  
    l.scanStartElement(Unknown Source)  
            at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImp  
    l$FragmentContentDriver.next(Unknown Source)  
            at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(U  
    nknown Source)  
            at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImp  
    l.scanDocument(Unknown Source)  
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)  
            at java.lang.Thread.run(Unknown Source)  
    Caused by: java.lang.IllegalArgumentException: taglib definition not consistent  
    with specification version  
            at org.apache.catalina.startup.TaglibLocationRule.begin(WebRuleSet.java:  
    1164)  
            at org.apache.tomcat.util.digester.Digester.startElement(Digester.java:1  
    276)  
            ... 30 more
    and when i remove web.xml file that time tomcat get started but i get below error in jsp page :-
    Java Code:
    exception  
      
    org.apache.jasper.JasperException: /test.jsp (line: 5, column: 2) The attribute prefix taglib_test does not correspond to any imported tag library  
        org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:42)  
        org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:408)  
        org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:149)  
        org.apache.jasper.compiler.Validator$ValidateVisitor$1FVVisitor.visit(Validator.java:1536)  
        org.apache.jasper.compiler.ELNode$Function.accept(ELNode.java:137)
    someone please help me to solve it....


    Thanks
    Anchit

  2. #2
    nicephotog is offline Member
    Join Date
    Mar 2012
    Posts
    41
    Rep Power
    0

    Default Re: Error in EL function

    WEB-INF/tags/first_tld.tld

    should be
    WEB-INF/first_tld.tld

    you don't store .tld in /tags/(its for .tag) or the uri would be
    /tags/first_tld.tld
    if this operates ok its up to you, but another problem also may be the _ underscore character in XML names (I don't recall whether thats valid).
    I avoid a lot of stranger stuff just to keep it simple.

Similar Threads

  1. Error using the LWJGL Display function.
    By bakerg in forum New To Java
    Replies: 0
    Last Post: 02-15-2012, 03:51 PM
  2. Help with Square root function and Overload(calc error)
    By racingoutbac in forum New To Java
    Replies: 3
    Last Post: 11-04-2010, 12:09 AM
  3. Replies: 0
    Last Post: 04-28-2010, 12:32 PM
  4. function call error
    By peter_thm in forum New To Java
    Replies: 2
    Last Post: 01-13-2010, 12:57 PM
  5. Replies: 3
    Last Post: 12-04-2009, 03:08 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •