File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes what is wrong with my tld Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "what is wrong with my tld" Watch "what is wrong with my tld" New topic
Author

what is wrong with my tld

A. Aka
Ranch Hand

Joined: Sep 08, 2012
Posts: 44
Hi,

I do not get why I am having this error :

HTTP Status 500 - /result.jsp (line: 2, column: 47) File "/DiceFunctions" not found


my tld is (which is in WEB-INF) :



my jsp is



thanks,
Stefan Evans
Bartender

Joined: Jul 06, 2005
Posts: 1016
This is the example from Head First Servlets and JSP 2nd edition pg-393?

Your JSP has an incorrect invocation of the function:


ie using a colon rather than a period between "mine" and "rollIt()"

Double check the tld file is in the WEB-INF directory
Double check that the uri in the tld matches the uri specified in your JSP.
restart your servlet container to see if that might fix it.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60057
    
  65

It's also a good practice to follow the conventions for URIs. In other words, they should look like a URL (even if they aren't one).


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39548
    
  27
Also note the mismatch between the function names: rollIt vs. rollDice.


Ping & DNS - updated with new look and Ping home screen widget
A. Aka
Ranch Hand

Joined: Sep 08, 2012
Posts: 44
@Stefan Evans, I did the change by putting colon but it still does not work and everything is ok regarding the check you asked for (Double check the tld file is in the WEB-INF directory, ...)

@Ulf Dittmer, I do not think what you are saying is correct, the function name in tld does not necessary need to have the same name as the real method
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39548
    
  27
You're right, I overlooked that the <name> tag was indeed for rollIt.
A. Aka
Ranch Hand

Joined: Sep 08, 2012
Posts: 44
I found the the problem, in jsp the uri should be "/WEB-INF/myFunction.tld"
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

A. Aka wrote:I found the the problem, in jsp the uri should be "/WEB-INF/myFunction.tld"

auto-discovery mechanism introduced in jsp1.2. container search for tld in WEB-INF hierarchy and lib/jar's META-INF heirarchy by default.
I am not sure why this mechanism is not working in your case.
Stefan Evans
Bartender

Joined: Jul 06, 2005
Posts: 1016
I think there is an issue with the xmlns entries in your <taglib> tag.

You have:


The one that works for me is


The difference being is that the onte that works locates the web-jsptaglibrary_2_0.xsd via its full url, rather than just by name.
Unless you have web-jsptaglibrary_2_0.xsd available locally, this will probably muck things up a bit.

A. Aka
Ranch Hand

Joined: Sep 08, 2012
Posts: 44
@Stefan Evans, you are right that was the issue and many thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: what is wrong with my tld
 
Similar Threads
EL Function undefined Error
custom EL function not working
Error with JSTL tags in eclipse
TLD file
Error : Mandatory TLD element jsp-version missing