posted 13 years ago
Simplifying, my problem is that whilst:
<c
ut value="date"/> works (printing out the literal text 'date'
What I actually want is to print out the value of the date (date is declared like this:
<jsp:useBean id="date" class="java.util.Date" />
However when I try:
<c
ut value="${date}"/>
Tomcat 5 throws this exception:
org.apache.jasper.JasperException: /FirstJSP.jsp(11,0) According to TLD or attribute directive in tag file, attribute value does not accept any expressions
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:83)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:404)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:183)
org.apache.jasper.compiler.Validator$ValidateVisitor.checkXmlAttributes(Validator.java:979)
org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:734)
org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1444
<snipped>
Any ideas?
[ May 29, 2004: Message edited by: Edward Kenworthy ]
<c

What I actually want is to print out the value of the date (date is declared like this:
<jsp:useBean id="date" class="java.util.Date" />
However when I try:
<c

Tomcat 5 throws this exception:
org.apache.jasper.JasperException: /FirstJSP.jsp(11,0) According to TLD or attribute directive in tag file, attribute value does not accept any expressions
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:83)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:404)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:183)
org.apache.jasper.compiler.Validator$ValidateVisitor.checkXmlAttributes(Validator.java:979)
org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:734)
org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1444
<snipped>
Any ideas?
[ May 29, 2004: Message edited by: Edward Kenworthy ]
Edward Kenworthy
Ranch Hand
Posts: 66
posted 13 years ago
With Tomcat 5 (JSP 2.0) you should be using JSTL 1.1 and make sure that your web.xml declares your app as a Servlet 2.4 app (uses the 2.4 xml schema versus the 2.3 DTD).
Edward Kenworthy
Ranch Hand
Posts: 66
Jeroen Wenting
Ranch Hand
Posts: 5093
posted 13 years ago
Sure it does. The behaviour of useBean is to find and, if you use the class attribute, create if not found, a bean of the specified class in the specified scope.
These scopes are the same as that searched by the JSTL.
Take for example:
this ends up as (using Tomcat 5):
The behavior is to create a scripting variable (which I never use since I no longer use Java scripting on pages in JSP 2.0 unless I absolutely have to) as well as to conditionally create the bean in request scope.
The JSTL doesn't care how the bean got there, it searches the scopes for variables which is just picks up by name. So whether xyz was placed on the request by a JSTL tag, jsp:useBean, or (as is very common in my code) a servlet controller, the JSTL tags will "see" it.
These scopes are the same as that searched by the JSTL.
Take for example:
this ends up as (using Tomcat 5):
The behavior is to create a scripting variable (which I never use since I no longer use Java scripting on pages in JSP 2.0 unless I absolutely have to) as well as to conditionally create the bean in request scope.
The JSTL doesn't care how the bean got there, it searches the scopes for variables which is just picks up by name. So whether xyz was placed on the request by a JSTL tag, jsp:useBean, or (as is very common in my code) a servlet controller, the JSTL tags will "see" it.