RE: el in JSTL / JSP 2.0
I had the same prob. And 2 things I did that worked: 1. try using the 2.4 schema definition in web.xml 2. if the PermittedTablibs.tld is involved make sure your taglib-uri is http://java.sun.com/jsp/jstl/core Good luck -Original Message- From: Paul Wallace [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 28, 2004 11:17 PM To: [EMAIL PROTECTED] Subject: el in JSTL / JSP 2.0 Hi, I am trying to introduce JSP 2 with Tomcat 5 (full source below), and thus experimenting with the JSTL expression language in JSP tag files (.tag). I am bemused as to why I cannot embed the expression language within a JSTL tag thus: c:forEach begin=${a} end=${b} varStatus=status ${status.count} br/ /c:forEach Tomcat is really unhappy with this: org.apache.jasper.JasperException: /WEB-INF/tags/wrapper.tag(13,4) According to TLD or attribute directive in tag file, attribute begin does not accept any expressions org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHand ler.java:39) the same code with c:forEach begin=1 end=5 varStatus=status iterates 5 times with no trouble. I have the latest tld's from Jakarta, status.count is displaying correctly. Any thoughts please? Thanks Paul. jsp: %@ taglib prefix=tags tagdir=/WEB-INF/tags % %@ taglib uri=http://java.sun.com/jstl/core; prefix=c % tags:wrapper a=1 b=10 p Wrapped Content /p /tags:wrapper .tag: %@ taglib uri=http://java.sun.com/jstl/core; prefix=c % %@ tag body-content=scriptless % %@ attribute name=a required=true % %@ attribute name=b required=true % p Attributes - ${a}, ${b} /p c:forEach begin=${a} end=${b} varStatus=status ${status.count} br/ /c:forEach
RE: el in JSTL / JSP 2.0
Hi, Tbanks for that. I was using the 2.4 schema: web-app 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; version=2.4 And tried (although PermittedTablibs.tld is not in the picture): taglib taglib-urihttp://java.sun.com/jsp/jstl/core/taglib-uri taglib-location/WEB-INF/tld/c.tld/taglib-location /taglib Using this gave me a 500 error (can't find said file). Before edition it looked something like: taglib taglib-urihttp://java.sun.com/jstl/core/taglib-uri taglib-location/WEB-INF/tld/c.tld/taglib-location /taglib The code hasn't changed (below). Are you suggesting I use that URL in the JSP / .tag? If so, my IDE cannot resolve the library (IDEA). Thanks for your thoughts. Paul. I had the same prob. And 2 things I did that worked: 1. try using the 2.4 schema definition in web.xml 2. if the PermittedTablibs.tld is involved make sure your taglib-uri is http://java.sun.com/jsp/jstl/core Hi, I am trying to introduce JSP 2 with Tomcat 5 (full source below), and thus experimenting with the JSTL expression language in JSP tag files (.tag). I am bemused as to why I cannot embed the expression language within a JSTL tag thus: c:forEach begin=${a} end=${b} varStatus=status ${status.count} br/ /c:forEach Tomcat is really unhappy with this: org.apache.jasper.JasperException: /WEB-INF/tags/wrapper.tag(13,4) According to TLD or attribute directive in tag file, attribute begin does not accept any expressions org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHand ler.java:39) the same code with c:forEach begin=1 end=5 varStatus=status iterates 5 times with no trouble. I have the latest tld's from Jakarta, status.count is displaying correctly. Any thoughts please? Thanks Paul. jsp: %@ taglib prefix=tags tagdir=/WEB-INF/tags % %@ taglib uri=http://java.sun.com/jstl/core; prefix=c % tags:wrapper a=1 b=10 p Wrapped Content /p /tags:wrapper .tag: %@ taglib uri=http://java.sun.com/jstl/core; prefix=c % %@ tag body-content=scriptless % %@ attribute name=a required=true % %@ attribute name=b required=true % p Attributes - ${a}, ${b} /p c:forEach begin=${a} end=${b} varStatus=status ${status.count} br/ /c:forEach - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: el in JSTL / JSP 2.0
Hi, It took me a while to get IJ/Jboss3.2.5(tomcat5)/JDK1.5 working but the above finally rendered jstl 1.1 ${2+2} without using c:out value=${2+2}/ That is what I am trying to do, embed some el in my JSTL (two int attributes passed into my tag, and the tag then iterates for the defined number). It works with static nos, but does not accept the el (${status.count} is fine): c:forEach begin=${a} end=${b} varStatus=status ${status.count} br/ /c:forEach Where static values are fine: c:forEach begin=1 end=5 varStatus=status I made mods as per your email (source included at the foot). Idea 4.5 now is happy with %@ taglib uri=http://java.sun.com/jsp/jstl/core; prefix=c % in my JSPs (mysterious), but I am still getting the same message. Here's the 3 source files again. Thanks again for your help Paul. web.xml: web-app 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; version=2.4 jsp-config taglib taglib-urihttp://java.sun.com/jsp/jstl/core/taglib-uri taglib-location/WEB-INF/tld/c.tld/taglib-location /taglib /jsp-config . JSP: %@ taglib prefix=tags tagdir=/WEB-INF/tags % %@ taglib uri=http://java.sun.com/jsp/jstl/core; prefix=c % tags:wrapper a=1 b=10 p Wrapped Content /p /tags:wrapper wrapper.tag: %@ taglib uri=http://java.sun.com/jsp/jstl/core; prefix=c % %@ tag body-content=scriptless % %@ attribute name=a required=true % %@ attribute name=b required=true % c:forEach begin=${a} end=${b} varStatus=status ${status.count} br/ /c:forEach Message (same): org.apache.jasper.JasperException: /WEB-INF/tags/wrapper.tag(15,4) According to TLD or attribute directive in tag file, attribute begin does not accept any expressions org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHand ler.java:39) IDEA 4.5 will not complain about the 2.4 schema spec of web.xml however note jars in web-inf/lib will be default added to library. Try web.xml: ?xml version=1.0 encoding=ISO-8859-1? web-app 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; version=2.4 (as you have) jsp-config (new 2.4 xml tag) taglib taglib-urihttp://java.sun.com/jsp/jstl/core/taglib-uri taglib-location/WEB-INF/tld/c.tld/taglib-location (make sure this path is correct) /taglib /jsp-config /web-app Then in jsp: %@ taglib uri=http://java.sun.com/jstl/core; prefix=c % (must be same as in web.xml, technically can be anything unless permittedTags involved) Start simple w/ EL: ${2+2} With IDEA 4.5 you should get green bars for both the web.xml and the jsp file (the c.tld is all red, but no matter as tomcat 5 will still work) when the taglib-uri paths match. As part of the jsp 2.0 spec, taglib is optional in jsp's as the container knows of them by default. It took me a while to get IJ/Jboss3.2.5(tomcat5)/JDK1.5 working but the above finally rendered jstl 1.1 ${2+2} without using c:out value=${2+2}/ Sound like you are almost there... - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]