yami
yami

Reputation: 881

JSTL: Invalid syntax for function signature in TLD

I am trying to define a function in myTld.tld file like

<?xml version="1.0" encoding="UTF-8"?>
<taglib version="2.1" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd">

<tlib-version>1.0</tlib-version>
<short-name>customFunctions</short-name>
<uri>/WEB-INF/tags/myTld.tld</uri>

<function>
   <description>
       my Desc
   </description>
   <name>isActive</name>
   <function-class>com.Functions</function-class>
   <function-signature>boolean isActive()</function-signature>
 </function>
</taglib>

From El script i am calling like

<%@ taglib prefix="customFunctions" uri="/WEB-INF/tags/myTld.tld"%>
${customFunctions:isActive()}

Every time i do this, i am getting

Invalid syntax for function signature in TLD.  Tag Library: customFunctions, Function: isActive

Upvotes: 0

Views: 2886

Answers (2)

yami
yami

Reputation: 881

There seems to be no issue with respect to function-signature. Description can be broken to multiple line as long as they are closed in the proper tag structure. Even the return type can be given as primitive.

But thanks for your support. I just tried after few hour the same thing and it ran successfully. Not sure why Tomcat gave me strange error(Even after multiple compilation and redeployment). Though i feel the Tomcat should be little more smart enough to tell the exact error when it says signature is wrong.The tomcat log also did not gave me any other information.

Upvotes: 0

Alex
Alex

Reputation: 11579

Change

<function-signature>boolean isActive()</function-signature>

to

<function-signature>java.lang.Boolean isActive()</function-signature>

Also change <description>my Desc</description> to one line. It could be (could be not) a problem as well.

Upvotes: 1

Related Questions