Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Whats Wrong?

 
Pawan Ramchandani
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Help Me

Error:- Invalid syntax for function signature in TLD. Tag Library: d, Function: do


Function:-

package foo;

public class Test
{
public static void print()
{
System.out.print("Hello WOrld");
}

}


TLD:-

<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_4.xsd"
version="2.4">
<tlib-version>1.2</tlib-version>

<uri>Rendom</uri>
<function>
<name>do</name>
<function-class>foo.Test</function-class>
<function-signature>void print()</function-signature>
</function>
</taglib>


JSP:-

<%@ taglib prefix="d" uri="Rendom"%>

<html><body>

${d o()}

</body></html>



Thanks
[ October 02, 2004: Message edited by: Pawan Ramchandani ]
 
Nathaniel Stoddard
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you need the "void" in the function signature, or is the return type only specified in the TLD when you actually return something?
 
Romy Huang
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have problem with this too.

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>
[ October 04, 2004: Message edited by: Romy Huang ]
 
Sohil Ladhani
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Romy Huang wrote:I have problem with this too.

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>
[ October 04, 2004: Message edited by: Romy Huang ]


Try <function-signature>int rollDice()</function-signature> (i.e. in the single line) in the TLD file. It worked for me. May be it is the correct syntax.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic