Tuesday, December 12, 2006

According to TLD or attribute directive in tag file, attribute value does not accept any expressions

Keywords:
Compile JSP tomcat JSTL error "According to TLD or attribute directive in tag file, attribute value does not accept any expressions"

Problem:
Compile error from tomcat when it encounters a JSP: "According to TLD or attribute directive in tag file, attribute value does not accept any expressions"

Solution:
For some reason the JSP is using the 1.2 JSP (and 1.0 JSTL) and EL expressions aren't understood. There's a lot of hits on the web for this but in summary there are 2 important things to do to ensure you're getting the right version of the spec:
  1. Reference the correct servlet specification in your deployment descriptor:
    <?xml version="1.0"?>
    <web-app version="2.4"
     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 http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
  2. Reference the correct JSTL uri in your JSP:
    change
    <%@ taglib uri='http://java.sun.com/jstl/core' prefix='c'%>

    to
    <%@ taglib uri='http://java.sun.com/jsp/jstl/core' prefix='c'%>

Notes:


What Specification goes with what?
Web-app(deployment schema)2.32.42.5
http://java.sun.com/dtd/web-app_2_3.dtdhttp://java.sun.com/xml/ns/j2ee/web-app_2_4.xsdhttp://java.sun.com/xml/ns/javaee/web-app_2_5.xsd
Servlet2.32.42.5
JSP1.22.02.1
JSTL(core uri reference)1.01.11.2
http://java.sun.com/jstl/corehttp://java.sun.com/jsp/jstl/corehttp://java.sun.com/jsp/jstl/core
Tomcat4.x5.x6.x
WebSphere5.x6.x7.x (?)

100 comments:

Anonymous said...

Thank you very much! This hint was very helpful for me!!

Anonymous said...

OMG ... two days lost Tnx!

Anonymous said...

This help me too, thank you

Anonymous said...

Saved my day! Thanks a lot.

Anonymous said...

Saved my day! Thanks a lot.

Anonymous said...

Danke. Habe 1 Tag vergeblich den Fehler gesucht.

Anonymous said...

Thanks a bunch!!! Saved my bacon!

Anonymous said...

Thank you!! It drove me to dispair...

Anonymous said...

Thank u very Much

Anonymous said...

This site Helps Me thank u very Much

Anonymous said...

Thanks dude!!! 2 hours left just for uri="http://java.sun.com/jsp/jstl/core" hahahaha

Anonymous said...

Great. Saved my time too.

Anonymous said...

Great. Saved my time too.

Anonymous said...

Another thank you from me. I only besucht den Fehler for four hours, but this was a real lifesaver.

Dónal Boyle said...

Brilliant, you saved me a lot of pain!

Anonymous said...

This is great!!!
Thanks a lot.
This really helped me a lot.

Anonymous said...

This error also happens if you include the tag libraries twice.

I had the same problem with one include which I forgot to delete that had the directives for including the libraries.

Anonymous said...

Thanx alot i spent half day to find out solution but didn,t get ur trick worked for me it saves lot of time thanx again

Anonymous said...

I have wasted 2 days to find the solution for this. Thanks a lot.

Chandu said...

thanx for giving solutions for this type of error

Anonymous said...

thanks
it's work for me
- Joshua

Anonymous said...

Thank you very much!!!

Anonymous said...

Thanks buddy. I have already spent 6 hours wasting. Thanks a lot again.

Anonymous said...

Heck yea, this totally solved my problem. Thanks buddy!

Anonymous said...

G'day mate.
Saved my day!
Thanks!

Anonymous said...

Cheers mate. Thanks for your help.
/Andy

Anonymous said...

thanks

Anonymous said...

The Force will be with you. :)

Anonymous said...

Thanks a lot!!!

Anonymous said...

That was very helpful. Thank you.

Anonymous said...

Thank you very much - this was exactly the answer I was looking for!

Anonymous said...

That's works! Thanks!

Anonymous said...

Thanks

very helpful infomations

Anonymous said...

thanks very much! i could avoid a ton of frustration.

Anonymous said...

thx very much

nandx - indonesia

Anonymous said...

Yes, that helped me also! You would think that servlet containers/jsp compilers could be a little more helpful when reporting these sorts of issues.

Thanks for publishing!

Anonymous said...

Yet another thank you!

Anonymous said...

thank you. It helped me to fix.

Anonymous said...

thank you for the really really useful hint

Anonymous said...

I highly appreciate your post. It was very helpful.

Anonymous said...

Thank you so much! great work!

Anonymous said...

Live long and prosper, my friend.

Gaurav Pandey Blog said...

Great effort i appreciate ur effort

Anonymous said...

You saved me a lot of time! Thanks a lot from germany!

David Uvalle said...

Thank you for writing that post.

Dharmveer said...

Extemely helpful. Saved my day.

Anonymous said...

Thank you, I was having this same problem with JSTL Format.

gayatri said...

thanks a liot it really helped..awesome

Anonymous said...

thanku very much

Anonymous said...

Hi Buddy, Thanks a lot. This information was very useful.

Anonymous said...

Thanks.. it helped me a lot

Akalanka said...

hey now we use web-app 2.5.
there we can use

xml version="1.0" encoding="UTF-8"
web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5"

in the web.xml as the schema and we can use the taglib

@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"
@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"
in this way.This is also working.....

and please put the relevant greater and lesser than marks in appropriate places.

Akalanka said...

hey please use the jstl-1.2.jar.
sorry forgot to mention in the previous one....
download jar files @ http://www.jarfinder.com/

Neeraj Singh said...

Thank you so much man!!!

pollo said...

thanks help a lot!!

Anonymous said...

It worked ! Just changed taglib uri value and it worked. Thanks a lot.

Albert said...

appriciate!

Anonymous said...

Thank you very much. its very useful for me. Thank you a lot.

Anonymous said...

I can't believe it took me half a day to fix this. Thanks for this post. The problem with tomcat/spring/jstl stuff is that there're so many outdated blogs/tips/tutorial out there that're totally misleading.

Unknown said...

Thank you )

JavaRookie said...

Thanks a million!

Anonymous said...

Thanks very much!!

Anonymous said...

thanx a Lot man !! :)

Anonymous said...

Thanks.Your hints helped me to deploy my application successfully

GopiKrishnan said...

Gr8 seriousli .... helped me save a lot of time...

Anonymous said...

Danke schön! Thank you!

V.W said...

Thanksss many many times

Balu said...

Great support for all

Anonymous said...

Thank you! You saved my time...

Anonymous said...

thanks a lot....it worked for me

srini said...

Thankyou very much. This saved my time.

Anonymous said...

Thank you!!!

Madan said...

thank you for http://java.sun.com/jsp/jstl/core

Anonymous said...

Thank you...It was the link problem.

Dennis said...

Thank u. This is a simple solution for my big problem.

Anonymous said...

Hey this is really helpful thank you very very much ... great

Unknown said...

Excellent Solution, Tanks a lot for your correct solution.
Regards
Muthuvel.P

Unknown said...

thank you very much for the solution.

Anonymous said...

Can't fu...g believe...
1 day lost for this.. many thanks. man

roy! said...

it worksssss...nice... :)

roy! said...

i did this
<%@ page isELIgnored ="false" %>

<%@ taglib uri='http://java.sun.com/jsp/jstl/core' prefix='c'%>

i just used these and web xml was still at 2.3 spec and
lib had to jars
jstl.jar
standard.jar

but i guess the tag lib decl modification helped a ton
thank you so much

Anonymous said...

screwed for 2 days. finally got it. very useful post

Anonymous said...

thanks so much .saved my lot of time.
very useful information

Anonymous said...

Very useful information.
Should've googled before...

ugo.nakawaka said...

Thanks

Anonymous said...

Thank you very much.. it help me to save my job.

Anonymous said...

Thanks a lot for this information. This helped me a lot.

Anonymous said...

Thank you very very much !!!

Dipak said...

wasted 2 days to fix this... This post helped me alott.. thanks...

Anonymous said...

I owe you a beer!

Swatika said...

Thanx for the information,it helps me al lot......

Anonymous said...

It is very useful. It helps me too. Thank You very much

Anonymous said...

it solved ma problem .... thanks

Rico said...

Thanks a lot... You saved me!

Jonny said...

Spot on! Thank you very much for this!

Such a simple thing, but easy to miss!

Anonymous said...

Thanks for your gr8 help.
Really appreciable.

Anonymous said...

thank you very much.i was able to solve the problem.
i am using netbeans 7.0 my
web-app version 3.0 .hence i have to go for jstl 1.1 or higher,when i add it to my project solved the problem .once agin thank you very much.sir.

Anonymous said...

thanks your tutorial helped me lot to figure out the issue.once agina thnak you

sazzad said...

Thanks a bunch dude!

sazzad said...

saved a day!!