• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem in using TLDs

 
Puja Verma
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI friends...

I am trying to implement the rollIt program of HRSJ, but I am encountering some problem in excuting my rollIt function.

Here is my code :

TestBean.jsp
<%@ taglib prefix="mine" uri="DiceFunctions" %>
<html>
<body>

${mine.rollIt()}

</boby>
</html>
=========================================================================
Tld file :
<?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>foo.DiceRoller</function-class>
<function-signature> int rollDice() </function-signature>
</function>
</taglib>
=========================================================================
[B]My rollDice function[/B]
package foo;

public class DiceRoller {

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

}
===========================================================================
Out which I am getting is :

${mine.rollIt()}
===========================================================================

I dont understand why it is not executing the function and printing the statement as it is...

........................................................................
thanks,
Pooja
 
Mohd Fuzail
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
instead of use
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic