Вопрос

Hi I just created custom tag being used in my JSP The .tld of the tag is something like this

<?xml version="1.0" encoding="UTF-8"?>
<taglib>
<tlibversion>1.0</tlibversion>
<jspversion>1.1</jspversion>
<shortname>acma</shortname>
<info>AccountManag</info>
<tag>
    <name>clookup</name>
    <tagclass>taglib.acm</tagclass>
    <info>Customer Lookup</info>
    <attribute>
      <name>cust_id</name>
      <required>true</required>
    </attribute>
</tag>
</taglib>

Now the tag works great when i use it with an int value like so cust_id="1"

  <dd:clookup cust_id="1"></dd:clookup>

but it doesnt work when i use EL .with it like

 <dd:clookup cust_id="${sessionScope.cust.id}"></dd:clookup>

All the tutorials start of with int or other data type so i cant locate any resource that might help here.. any suggestions ?

Это было полезно?

Решение

Specify rtexprvalue in your tld:

<attribute>
  <name>cust_id</name>
  <required>true</required>
  <rtexprvalue>true</rtexprvalue>
</attribute>

See Tag Library Descriptors for more details.

Другие советы

Your EL needs to be enclosed in quotes.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top