File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes What's wrong with El function. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "What Watch "What New topic
Author

What's wrong with El function.

Romy Huang
Ranch Hand

Joined: Sep 30, 2003
Posts: 35
Help please.

Error message:
org.apache.jasper.JasperException: The class specified in the method signature in TLD for the function mine:rollIt cannot be found.
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:94)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:404)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:219)
org.apache.jasper.compiler.Validator$1MapperELVisitor.visit(Validator.java:1405)
org.apache.jasper.compiler.ELNode$Function.accept(ELNode.java:163)
org.apache.jasper.compiler.ELNode$Nodes.visit(ELNode.java:234)
org.apache.jasper.compiler.ELNode$Visitor.visit(ELNode.java:275)
org.apache.jasper.compiler.ELNode$Root.accept(ELNode.java:94)
org.apache.jasper.compiler.ELNode$Nodes.visit(ELNode.java:234)
org.apache.jasper.compiler.Validator$ValidateVisitor.getFunctionMapper(Validator.java:1420)
org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:637)
org.apache.jasper.compiler.Node$ELExpression.accept(Node.java:913)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2180)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2230)
org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2236)
org.apache.jasper.compiler.Node$Root.accept(Node.java:485)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2180)
org.apache.jasper.compiler.Validator.validate(Validator.java:1515)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:247)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:456)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:552)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:291)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)


JSP page:
<%@ taglib prefix="mine" uri="DiceFunctions" %>
<html>
<body>
${mine:rollIt()}
</body>
</html>

Function:
package foo;

public class DiceRoller
{
public static int rollDice()
{
return (int) ((Math.random()*6)+1);
}
}

TLD:
<?xml version="1.0" encoding="UTF-8" ?>

<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/web-jsptaglibrary_2_0.xsd"
version="2.0">

<tlib-version>1.2</tlib-version>

<uri>DiceFunctions</uri>
<function>
<name>rollIt</name>
<function-class>
foo.DiceRoller
</function-class>
<function-signature>
int rollDice()
</function-signature>
</function>
</taglib>
Bart Allen
Greenhorn

Joined: Dec 19, 2003
Posts: 21
are you sure that your compiled class is in the:

%TOMCAT_HOME%/webapps/yourwebapp/WEB-INF/classes/foo/

directory?


SCJP, SCWCD, SCBCD, SCJD
Romy Huang
Ranch Hand

Joined: Sep 30, 2003
Posts: 35
yes. I put the class in classes/foo/ directory.
Bart Allen
Greenhorn

Joined: Dec 19, 2003
Posts: 21
I copied your exact code out of your post and it works perfectly. Your code is finding your TLD, given the error you're getting would be different had it not. The only thing I can think of is maybe you didn't copy your .class file from your dev env to your deployed environment.
Romy Huang
Ranch Hand

Joined: Sep 30, 2003
Posts: 35
Thank Bert. My tomcat version is 5.0.6. I change to version 5.0.28. Now it work fine. Thank you a lot.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: What's wrong with El function.