- This topic has 2 replies, 2 voices, and was last updated 17 years, 7 months ago by Benedict Poole.
-
AuthorPosts
-
Benedict PooleMemberI hope someone can advise. I’ve solved my issue, but I can’t help think I’ve done it in a somewhat perverted manner…
I’m knocking up my first Spring MVC app in MyEclipse (5.1.1 GA on WinXP). One of my JSPs needs to reference the Spring tag library. I read somewhere else on this forum about someone having issues with a taglib because they referenced said lib in their deployment descriptor, but didn’t need to, as the containing JAR was on their build path already, and the builders get confused…
Anyway, I have a bunch of Spring JARs on my build path (including Spring 1.2. Web Libraries), but the JSP editor was warning me about my Spring-specific tags (it couldn’t resolve them).
I tried all manner of things — even the “Add JSTL Libraries” wizard which tantalisingly showed me “spring.tld” in “Spring 1.2 Web Libraries” thus:
spring.tld - MYECLIPSE_SPRING_DATA_HOME/1.2/lib/spring.tld
… but didn’t allow me to add it to my project.
Finally, I gave up and downloaded the 1.2.8 Spring distribution. grabbing spring.tld from that and directly adding it to my WEB-INF directory.
I can’t help but feel that this isn’t right, that I’ve missed something: thoughts?
Riyad KallaMemberbenpoole,
You are right, there is an easier way to do this. As long as the JARs on your build path ship the TLD inside of them, you can simply use the default URI defined in the taglib itself and it will work. (More information on how this works here: https://www.genuitec.com/forums/topic/jsp-taglib-marked-as-invalid-unknown-or-no-autocomplete/)Take a look at the screenshot below to see how to determine the default URI to use inside your JSP pages.
So your JSP taglib entry would look like:
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring" />
then in your pages your <spring: /> tags will resolve fine.
Attachments:
You must be logged in to view attached files.
Benedict PooleMemberSuperb, many thanks – especially for such a quick response!
-
AuthorPosts