//JSP file
<%@ taglib prefix="mine" uri="DiceFunctions"%>
<html><body>
${mine:rollIt()}
</body></html>
//myFunctions.tld under WEB-INF
<taglib xmlns="http://java.sun.com/xml/ns/j2ee" 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>
// DiceRoller.java under WEB-INF\classes
import java.util.*;
public class DiceRoller{
public static int rollDice(){
return (int) ((Math.random() * 6) + 1);
}
}
// web.xml under WEB-INF
<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_4.xsd" version="2.4">
<display-name>Welcome to
Tomcat</display-name>
<description>
Welcome to Tomcat
</description>
<!-- JSPC
servlet mappings start -->
<servlet>
<servlet-name>TestBean</servlet-name>
<jsp-file>/Test3/TestBean.JSP</jsp-file>
</servlet>
<jsp-config>
<taglib>
<taglib-uri>DiceFunctions</taglib-uri>
<taglib-location>/WEB-INF/myFunctions.tld</taglib-location>
</taglib>
</jsp-config>
<!-- JSPC servlet mappings end -->
</web-app>
I also add jstl.jar in my WEB-INF/lib directery.But still this program does not work.As output I get only ${mine:rollIt()}.In my computer I can not run EL .I always get same result ${....} ,no output.Could you tell me how i can fix this problem?Thanks in advance.
Cheers,