Q:

JSP String formatting Truncate

Does anyone know how to truncate a string in a JSP using a tag library? I was going to use Jakarta Taglibs but it says that it has been retired because: 

With the advent of JSTL, the core features of many of the libraries had been standardized and the need for these libraries diminished. As such, much of the Taglibs codebase moved into maintenance mode.

A:

You can use the JSTL substring function:
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>

${fn:substring(myVariable, 0, 5)}

