• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

spring?

 
Erwin Bredford
Ranch Hand
Posts: 167
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am a spring newbie .
i am testing out some spring code from the mvc step-by-step toturial and i dicovered that the jstl tags
<c ut value="${product.name}">
throws an error saying that that tag does not support expression language .
so i want to use scriptlets instead of tags that come with the tutorial.does anyone how to use jsp scriptlets with spring .thanks


please could u help me out
 
Craig Walls
author
Ranch Hand
Posts: 363
8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by chinedu efoagui:
i am a spring newbie .
i am testing out some spring code from the mvc step-by-step toturial and i dicovered that the jstl tags
<c ut value="${product.name}">
throws an error saying that that tag does not support expression language .
so i want to use scriptlets instead of tags that come with the tutorial.does anyone how to use jsp scriptlets with spring .


I could help you use Spring with scriptlets, but I'd rather help you fix your JSTL problem. Which JSTL JARs are you using? How are you declaring the tags (in web.xml or in the JSP pages themselves)?

This is important because JSTL tags come in two flavors: those that use JSTL EL and those that use JSP runtime EL.

In JSTL 1.0, you had to be specific about which TLD to use: either c.tld or c-rt.tld. If you use c.tld, you'll get the errors like you described. If you use c-rt.tld, then you should be fine. (The same applies to fmt.tld and the others, but I'm just picking on c.tld because it's the most commonly used set of tags.)

In JSTL 1.1, there's only one TLD file and things are much simpler. The c.tld handles runtime EL fine and you don't have to declare the tags in web.xml. Just have the JAR files in the classpath and specify the tag in the JSP file as:



There really needs to be a definitive and well-publicized FAQ on this. I personally struggle with the same issue almost every time I start a new project. Once you get it setup right, developing with JSTL is a breeze. But if you're like me, you forget how you did it last time and have to look it up again (or cut-n-paste from another project).

If you're still struggling with this, let me know and I'll show you how to use scriptlets...but you really should try to get JSTL working before you resort to scriptlets.
 
Erwin Bredford
Ranch Hand
Posts: 167
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks i got it working with jstl i used
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
and copied the jstl.jar from netbeans 4.0 to my lib instead from the jstl.jar from the spring framework 1.5
thanks again
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic