wood burning stoves*
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


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
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: 45
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: 1018
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: 61071
    
  66

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: 41587
    
  54
Also note the mismatch between the function names: rollIt vs. rollDice.


Ping & DNS - my free Android networking tools app
A. Aka
Ranch Hand

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

Joined: Sep 08, 2012
Posts: 45
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: 1018
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: 45
@Stefan Evans, you are right that was the issue and many thanks
 
wood burning stoves
 
subject: what is wrong with my tld