Anirudh Giran
Anirudh Giran

Reputation: 85

Format the rendered output of a JSP tag

I am working to upgrade an app from Java 8 to Java 17. The app uses JSP for front-end. I am running into issue with apache-taglib-string.jar

It has basic String formatting tags that encapsulate other JSP tags and format the rendered output of the encapsulated tag. enter image description here

I replaced the use of this taglib wherever the code just format a value with JSTL Functions however, in a few particular cases JSTL Fn is not working as the string to format is not available in the JSP request context and rather is provided by a tag.

Example:

<s:upperCase>
    <fmt:formatDate value="${someMonth}" pattern="MMM"/>
</s:upperCase>

<s:upperCase>
    <spring:message code="some.label"/>
</s:upperCase>

<s:upperCase>
    <sl:lookup bundle="someBundle" key="${someValue}" defaultToKey="true"/> 
</s:upperCase>

In the above examples, the body for upperCase tag (org.apache.taglibs.string.UpperCaseTag) is provided by only when the children element is rendered.

I checked the latest Apache Taglib docs and looks like String tags are gone: https://tomcat.apache.org/taglibs/standard/apidocs/

Am I looking at the wrong taglib docs? Is there any other way to achieve the same result?

Upvotes: 0

Views: 21

Answers (0)

Related Questions