Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

body-content as scriptless

 
Vani Chinta
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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>
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Vani Chinta
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, it did work.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic