Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSTL & EL, not resolving my ${identifier} syntax?

 
Chris Corbyn
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


The NavigationMenu bean is just a subclass of LinkedHashSet, using the generic <NavigationItem>. NavigationItem itself is a bean with properties "text", "url" and "active".

When NavigationMenu has 5 items in it my loop only runs for one iteration and the ${item.text} and ${item.url} strings are just output directly without being resolved.

I know I must be doing something wrong but I'm not sure what

The taglib uri I'm specifying is http://java.sun.com/jsp/jstl/core (indicated in the Jakarta taglibs README file).

I can post the source for NavigationMenu and NavigationItem if needed although I doubt that's where the problem lies.

[ September 08, 2007: Message edited by: Chris Corbyn ]
[ September 08, 2007: Message edited by: Chris Corbyn ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64855
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look at the View Source from the browser. Are the JSTL tags getting evaluated? From your symptoms, I'd think perhaps not.
 
Chris Corbyn
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the help

The tags are being evaluated in the source yes. They disappear. If I do:



I just get ${i} literally output 5 times. I've tried using /jstl/core_rt instead of /jsp/jstl/core but it makes no difference.

All I did to install JSTL on my tomcat6 contain was download Jakarta's JSTL package (1.1.2) and copy lib/standard.jar and lib/jstl.jar into the libs directory with everything else. I got the impression this was all I needed to do, but I suspect I've missed something.
 
Chris Corbyn
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
*sobs*. Well I just installed the examples which Jakarta provide "standard-examples.war" and low and behold they work.

Here's my actual page (added more JSTL since last post, knowing that it 'will' work when I fix this problem :P)

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64855
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Chris Corbyn:
I just get ${i} literally output 5 times.
Sounds like the EL is not enabled for your app. Did you declare the app properly using the Servlets 2.4 schema as outlined in the JSP FAQ? Or are you using the 2.3 DTD?

I've tried using /jstl/core_rt
That's a JSTL 1.0 library. Forget it exists.

All I did to install JSTL on my tomcat6 contain was download Jakarta's JSTL package
Your issue is not with the JSTL.
 
Chris Corbyn
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you declare the app properly using the Servlets 2.4 schema as outlined in the JSP FAQ? Or are you using the 2.3 DTD?


Bingo! Now I feel stupid

EDIT | BBCode syntax wasn't compatible
[ September 08, 2007: Message edited by: Chris Corbyn ]
 
Chris Corbyn
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think I'm losing my marbles The EL is now being interpreted correctly after chaning to the 2.4 web-app declaration, but now my custom tags are causing errors.



/WEB-INF/jsp/layout/layout.jsp(31,22) According to TLD or attribute directive in tag file, attribute to does not accept any expressions



[ September 08, 2007: Message edited by: Chris Corbyn ]
 
Chris Corbyn
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, somebody shoot me between the eyes then delete this thread

rtexprvalue. I never quite broke that string down into RT Expr Value before now

Solved
[ September 08, 2007: Message edited by: Chris Corbyn ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic