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 JSTL & EL, not resolving my ${identifier} syntax? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "JSTL & EL, not resolving my ${identifier} syntax?" Watch "JSTL & EL, not resolving my ${identifier} syntax?" New topic
Author

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

Chris Corbyn
Ranch Hand

Joined: Jan 14, 2007
Posts: 114


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

Joined: Jan 10, 2002
Posts: 60053
    
  65

Look at the View Source from the browser. Are the JSTL tags getting evaluated? From your symptoms, I'd think perhaps not.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Chris Corbyn
Ranch Hand

Joined: Jan 14, 2007
Posts: 114
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

Joined: Jan 14, 2007
Posts: 114
*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

Joined: Jan 10, 2002
Posts: 60053
    
  65

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

Joined: Jan 14, 2007
Posts: 114
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

Joined: Jan 14, 2007
Posts: 114
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

Joined: Jan 14, 2007
Posts: 114
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 ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSTL & EL, not resolving my ${identifier} syntax?
 
Similar Threads
EL/JSTL Help
JSTL iteration of a list with numbering
Websphere 6 not recognizing c:forEach
Bad practise? JavaBean where setX() actually should be addX()?
Passing an object parameter to an included file