wood burning stoves
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes body-content as scriptless Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "body-content as scriptless" Watch "body-content as scriptless" New topic

body-content as scriptless

Vani Chinta
Ranch Hand

Joined: Mar 25, 2007
Posts: 38
I am trying an example with body-content tag as scriptless. when I give EL in jsp, i am getting this exception. "org.apache.jasper.JasperException: /customtag.jsp(8,29) Expression language not allowed in a template text body."

Is n't EL allowed in tag body when body-content is specified as scriptless?

Here is my tld

<?xml version="1.0" encoding="ISO-8859-1" ?>
<taglib xmlns="http://java.sun.com/xml/ns/j2ee"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd" version="2.0">
<description>Random advice</description>

and JSP:

<%@ taglib prefix="mine" uri="customTags"%>
<title>Custom Tag</title>
Using an advice custom tag
<jsp:attribute name="user">${userName}</jsp:attribute>

SCJP 1.4
Christophe Verré

Joined: Nov 24, 2005
Posts: 14688

I think that the problem comes from that your "user" attribute does not accept runtime expressions. The jsp:attribute has the following condition :
For standard or custom action attributes that do not accept a request-time expression
value, the Container must use the body of the <jsp:attribute> action as
the value of the attribute. A translation error must result if the body of the
<jsp:attribute> action contains anything but template text.

So you have to set the rtexprvalue of the user attribute to true.
[ December 06, 2007: Message edited by: Christophe Verre ]

[My Blog]
All roads lead to JavaRanch
Vani Chinta
Ranch Hand

Joined: Mar 25, 2007
Posts: 38
Thanks, it did work.
I agree. Here's the link: http://aspose.com/file-tools
subject: body-content as scriptless
It's not a secret anymore!