This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "body-content as scriptless" Watch "body-content as scriptless" New topic
Author

body-content as scriptless

Vani Chinta
Ranch Hand

Joined: Mar 25, 2007
Posts: 38
Hi
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"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd" version="2.0">
<tlib-version>1.2</tlib-version>
<uri>customTags</uri>
<tag>
<description>Random advice</description>
<name>advice</name>
<tag-class>com.example.web.AdvisorTagHandler</tag-class>
<body-content>scriptless</body-content>
<attribute>
<name>user</name>
<required>true</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
</tag>
</taglib>

and JSP:

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


SCJP 1.4
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

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
 
Similar Threads
customTags
Simple Tag with Attribute
Why in tld,you need add attribute type?
SchemaLocation Error In Eclipse IDE
SimpleTagSupport class