Função EL não funciona

Ae, fiz uma função EL mas não ta dando certo nem a pau… :???: Segue oq tenho:

a classe com o método static:

package com.foo.el;

public class DiceRoller {

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

o arquivo .tld q mapeia, myFunctions.tld, salvo em /WEB-INF

<?xml version="1.0" encoding="ISO-8859-1" ?>

<tablib 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>MyFunctions</uri>
	<function>
		<name>rollIt</name>
		<function-class>com.foo.el.DiceRoller</function-class>
		<funtion-signature>int rollDice()</funtion-signature>
	</function>

</tablib>

o jsp q chama a função no EL:

<%@ taglib uri="MyFunctions" prefix="mine" %>

<html>
	<head></head>
	<body>
		Roll Dice: ${mine:rollIt()}
	</body>
</html>

e a fucking expection lançada qnd tento acessar o jsp:

HTTP Status 500 -

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: Unable to compile class for JSP
	org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:565)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:293)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	com.foo.web.FooServlet.doGet(FooServlet.java:31)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

root cause

java.lang.NullPointerException
	org.apache.jasper.compiler.Validator$ValidateVisitor.getMethod(Validator.java:1283)
	org.apache.jasper.compiler.Validator$ValidateVisitor.processSignature(Validator.java:1271)
	org.apache.jasper.compiler.Validator$ValidateVisitor.access$400(Validator.java:309)
	org.apache.jasper.compiler.Validator$1FVVisitor.visit(Validator.java:1262)
	org.apache.jasper.compiler.ELNode$Function.accept(ELNode.java:122)
	org.apache.jasper.compiler.ELNode$Nodes.visit(ELNode.java:193)
	org.apache.jasper.compiler.ELNode$Visitor.visit(ELNode.java:234)
	org.apache.jasper.compiler.ELNode$Root.accept(ELNode.java:53)
	org.apache.jasper.compiler.ELNode$Nodes.visit(ELNode.java:193)
	org.apache.jasper.compiler.Validator$ValidateVisitor.validateFunctions(Validator.java:1266)
	org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:607)
	org.apache.jasper.compiler.Node$ELExpression.accept(Node.java:896)
	org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
	org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2213)
	org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2219)
	org.apache.jasper.compiler.Node$Root.accept(Node.java:456)
	org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
	org.apache.jasper.compiler.Validator.validate(Validator.java:1489)
	org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:157)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
	org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:556)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:293)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	com.foo.web.FooServlet.doGet(FooServlet.java:31)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

note The full stack trace of the root cause is available in the Apache Tomcat/5.5.9 logs.

Help, oqq tem de errado? Ta tudo indo pro deploy direitinho, ja conferi :sad:

obs: Tomcat 5.5.9

Matheus,

tenta chamar na sua jsp assim:
<%@ taglib uri=“MyFunctions” prefix=“mine” %>

&lt;html&gt; 
   &lt;head&gt;&lt;/head&gt; 
   &lt;body&gt; 
      Roll Dice&#58; $&#123;mine&#58;rollDice&#40;&#41;&#125; 
   &lt;/body&gt; 
&lt;/html&gt; 

O que tem nesse: rollIt() ???

[size=“11”]
[color=“red”]

  • Editado: Lembre-se do BBCode [/color][/size]

Bem, deve chamar a função EL pelo seu <name> definido no tld, não pelo verdadeiro nome q esta na classe… :roll:

Tem razao!!!
Sempre usei jstl para fazer isso, nunca usei EL para isso, mas os procedimentos são os mesmos!
Foi mau por não poder te ajudar! :frowning:
haha

Fala Matheus!

Já tentou colocar a chamada sem os parênteses?

[quote=“fcardao”]Fala Matheus!

Já tentou colocar a chamada sem os parênteses?[/quote]

Bem, a sintaxe de EL cobra os parênteses… :roll:

confundi com custom tag library

up pro meu tópico… :up:

ninguém sabe onde estou errando? Algum SCWCD 1.4 ai pleeease :ypray:

Matheus,
vc tem algum exemplo de uma função de EL que vc fez que funciona?
Se tem manda ai pra min ver que fiquei currioso! Só vi JSTL pra isso ate hoje!
Manda aê!!!

Não, essa é a minha primeira. heaheahea

Aê Matehus!!!
tenta usar <function-signature>
invés de <funtion-signature>

è funtion mesmo???
Acho que é function!!
Olha aê!!

[quote=“AndersonAugusto”]Aê Matehus!!!
tenta usar <function-signature>
invés de <funtion-signature>

è funtion mesmo???
Acho que é function!!
Olha aê!![/quote]

baaaaahhhhhhhhhhhhhhhhhhhhhhhhh :mad:

Deu certo???

ainda não testei, mas com certeza é isso… q ratiada

opa, respondendo pra ninguém ficar com peso na conciencia… eahheahea, testei agora, deu certo :joia: Rá!