【问题标题】:JSTL - fmt:message and fmt:param toLowerCaseJSTL - fmt:message 和 fmt:param toLowerCase
【发布时间】:2019-12-16 11:37:30
【问题描述】:

我有以下 JSTL:

<fmt:message key="localizationKey1">
   <fmt:param> 
      <fmt:message key="enumValue.${reputation}"/>
   </fmt:param>
</fmt:message>

enumValue.reputation 给出了“非常好”、“完美”之类的字符串,对于这种情况,我需要将其设为小写“非常好”、“完美”。如何使其小写?

【问题讨论】:

标签: java jsp jstl


【解决方案1】:

将翻译后的消息存储到一个变量中,并使用来自functions taglib 的fn:toLowerCase

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

<fmt:message key="enumValue.${reputation}" var="reputation"/>

<fmt:message key="localizationKey1">
   <fmt:param> 
       ${fn:toLowerCase(reputation)}
   </fmt:param>
</fmt:message>

【讨论】:

    猜你喜欢
    • 2012-07-12
    • 2014-11-03
    • 2012-10-06
    • 1970-01-01
    • 2012-02-06
    • 1970-01-01
    • 2011-03-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多