Hi,
I am preparing for SCWCD with HeadFirst book. I am having trouble with example given in page # 389.
I am getting this exception
org.apache.jasper.JasperException: The class specified in the method signature in TLD for the function mine:rollIt cannot be found.
I am using
tomcat 5.0.12
J2SDK 1.4.2
DiceRoller.java
---------------
public class DiceRoller{
public static int rollDice( ){
return (int)((Math.random()*6)+1);
}
}
myFunction.tld
---------------
<?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/web-
jsptaglibrary_2_0.xsd" version="2.0">
<tlib-version>1.2</tlib-version>
<uri>DiceFunctions</uri>
<function>
<name>rollIt</name>
<function-class>DiceRoller</function-class>
<function-signature>int rollDice( )</function-signature>
</function>
</taglib>
TestBean.jsp
------------
<%@ taglib prefix="mine" uri="DiceFunctions"%>
<%@ page isELIgnored="false" %>
<html><body>
${mine:rollIt()}
</body>
</html>
Deployment structure:
--------------------
TOMCAT-HOME/webapps/ch8/TestBean.jsp
TOMCAT-HOME/webapps/ch8/WEB-INF/classes/DiceRoller.class
TOMCAT-HOME/webapps/ch8/WEB-INF/myfunction.tld
TOMCAT-HOME/webapps/ch8/WEB-INF/web.xml
can anyone explain where I am doing wrong? or this is a bug in tomcat 5.0.18?
Thanks in advance