JSP字符串格式化截断 [英] JSP String formatting Truncate

查看:117
本文介绍了JSP字符串格式化截断的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人知道如何使用标记库截断JSP中的字符串?我打算使用 Jakarta Taglibs ,但它说它有已经退休,因为:

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:


随着JSTL的出现,许多库的核心功能已经标准化,对这些库的需求减少了。因此,很多Taglibs代码库都进入维护模式。

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.


推荐答案

你可以使用 JSTL子字符串功能

<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>

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

这篇关于JSP字符串格式化截断的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆