sammi red

Greenhorn
+ Follow
since Dec 25, 2004
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by sammi red

Hi all,

there is a bug in tomcat earlier versions, which gives error when u used EL functions in jsps(figured out searching tomcat5.0 bug database). I tried the example with tomcat 5.0.28 and it worked fine.

Note: If u put your classes in deault package you will get following exception( So use packages)
org.apache.jasper.JasperException: Unable to compile class for JSP

Generated servlet error:
C:\jakarta-tomcat-5.0.28\jakarta-tomcat-5.0.28\work\Catalina\localhost\ch08\org\apache\jsp\TestBean_jsp.java:13: cannot resolve symbol
symbol : class DiceRoller
location: class org.apache.jsp.TestBean_jsp
_jspx_fnmap_0= org.apache.jasper.runtime.ProtectedFunctionMapper.getMapForFunction("m:rollIt", DiceRoller.class, "rollDice", new Class[] {});
^
1 error

Good look
thanks wasim,

But after moving it to package and changing .tld , i get same error again

thanks
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