Erik Beijnoff wrote:
When i use the xml syntax for a jsp page with Tomcat 5.0 Alpha and try to
reference a EL parameter in a template data attribute, the EL expression
gets output as plain text, i.e. it is treated as quoted plaintext within the
attribute. Is this the correct behaviour, or is it a bug in Tomcat? The
behavior seems a bit strange to me, I'd expect it to output the parameter.
I've been trying to find a clarification in the JSP 2.0, and JSTL 1.0
specification but unfonrtunately no luck so far. I'm also aware that I could
use JSP 2.0 tag <jsp:element> and <jsp:attribute> to work around the
problem, but if it can be avoided I'd rather do it the other way, since I
find the other way to do it cleaner.

Example:
<?xml version="1.0" encoding="ISO-8859-1"?>
<jsp:root
 xmlns:jsp="http://java.sun.com/JSP/Page";
 xmlns:c="http://java.sun.com/jstl/core";
 version="2.0">

<jsp:directive.page
 contentType="text/html"
 pageEncoding="ISO-8859-1"/>

<html>
<body>
    <div class="${1+2}">${1+2}</div>
</body>
</html>
</jsp:root>

Does the web application this page belong to use a Servlet 2.3 Deployment Descriptor (web.xml file)? If so, EL processing is turned off by default (for backwards compatibility). If this is the case, you have two options: 1) Change the web.xml file to the new Servlet 2.4 format, 2) Add a page directive in the file with the isELIgnored attribute set to false.

Also note that neither the JSP 2.0 spec nor Tomcat 5 is fully
cooked yet, so be prepared for things not being 100% in sync.
I've tested approach 1) with regular JSP files (not JSP Documents,
i.e. JSP in XML format) and it worked fine with a TC 5 version
from a few weeks ago, but I believe I had problems with approach 2).

Hans
--
Hans Bergsten                                <[EMAIL PROTECTED]>
Gefion Software                       <http://www.gefionsoftware.com/>
Author of O'Reilly's "JavaServer Pages", covering JSP 1.2 and JSTL 1.0
Details at                                    <http://TheJSPBook.com/>

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".

Some relevant archives, FAQs and Forums on JSPs can be found at:

http://java.sun.com/products/jsp
http://archives.java.sun.com/jsp-interest.html
http://forums.java.sun.com
http://www.jspinsider.com

Reply via email to