• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

body-content as scriptless

 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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>
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, it did work.
reply
    Bookmark Topic Watch Topic
  • New Topic