Search code examples
javajspjakarta-eejstljsp-tags

How to set a global directive for pageEncoding in *.tag custom tags?


In JSP you can use the following:

<jsp-config>
    <jsp-property-group>
        <url-pattern>*.jsp</url-pattern>
        <scripting-invalid>true</scripting-invalid> <!-- 1 -->
        <page-encoding>UTF-8</page-encoding> <!-- 2 -->
    </jsp-property-group>
    <jsp-property-group>
        <url-pattern>*.tag</url-pattern>
        <page-encoding>UTF-8</page-encoding>
    </jsp-property-group>
</jsp-config>

Is there a custom tag equivalent to set the encoding directive for all custom tags created using a *.tag file?


Solution

  • You can define JSP configuration parameters in deployment descriptor but tags declared in TLD (tag library decriptor). TLD have no encoding parameter and Deployment Descriptor have no such option for <taglib> element that means that you cant.