aspose file tools
The moose likes JSP and the fly likes what is wrong with my tld Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » JSP
Reply 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: 39
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: 1003
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: 56177
    
  13

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).


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Ulf Dittmer
Marshal

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


Android appsImageJ pluginsJava web charts
A. Aka
Ranch Hand

Joined: Sep 08, 2012
Posts: 39
@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: 35232
    
    7
You're right, I overlooked that the <name> tag was indeed for rollIt.
A. Aka
Ranch Hand

Joined: Sep 08, 2012
Posts: 39
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: 1003
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: 39
@Stefan Evans, you are right that was the issue and many thanks
 
I agree. Here's the link: http://zeroturnaround.com/jrebel/download
 
subject: what is wrong with my tld
 
Similar Threads
Error with JSTL tags in eclipse
TLD file
custom EL function not working
Error : Mandatory TLD element jsp-version missing
EL Function undefined Error