aspose file tools*
The moose likes JSP and the fly likes wierd exception in EL function Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "wierd exception in EL function" Watch "wierd exception in EL function" New topic
Author

wierd exception in EL function

Dinkar Chaturvedi
Ranch Hand

Joined: Mar 27, 2007
Posts: 42

Hello All,
I was trying my hands over EL functions for which I created a JSP with the following code:

~~~~~~~~~~~~~
<%@ taglib uri="diceroll" prefix="mine"%>
<html>
<body>
The dice value is ${mine:rollIt()}
</body>
</html>
~~~~~~~~~~~~~

I created a TLD file with the following content:

~~~~~~~~~~~~~
<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.0</tlib-version>
<jsp-version>2.0</jsp-version>
<short-name>mine</short-name>
<uri>diceroll</uri>
<function>
<name>rollIt</name>
<function-class>com.example.web.DiceRoller</function-class>
<function-signature>int rollDice()</function-signature>
</function>
<tag>
</tag>
</taglib>
~~~~~~~~~~~~~

The java code that this TLD points to is:

~~~~~~~~~~~~~
package com.example.web;

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

I am getting this exception while trying to access this JSP:
~~~~~~~~~~~~~
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 version 5.0.16. Can anyone tell me the reason for this and how can i get this working?

Regards
Dinkar
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

Everything looks fine.
1. Where did you put the DiceRoller.class ?
2. Did you try to reboot the container ?


[My Blog]
All roads lead to JavaRanch
Dinkar Chaturvedi
Ranch Hand

Joined: Mar 27, 2007
Posts: 42

The class file is in the WEB-INF\classes folder in the appropriate directory hirarchy i.e. WEB-INF\classes\com\example\web
and i yeah i did restart my container too.
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

bug 26628 fixed in Tomcat 5.0.19 :
http://tomcat.apache.org/tomcat-5.0-doc/changelog.html
Dinkar Chaturvedi
Ranch Hand

Joined: Mar 27, 2007
Posts: 42

Hi Satau,
Thanks a lot for clearing this doubt. I put some arbitrary parameters into it and its working fine now.

Regards
Dinkar
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: wierd exception in EL function