我想用Thymeleaf缩写一个字符串 [英] I want to abbreviate a string with Thymeleaf

查看:57
本文介绍了我想用Thymeleaf缩写一个字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个表,我想更改一列,该列包含一个字符串.例如:这是我的字符串"->这是我的...".我尝试这样做abbreviate().

 < td th:text ="$ {#strings.abbreviate($ {fgp.explanation},10)}"></td> 

但是我收到此错误:EL1043E:意外的令牌.预期为"rparen())"但是'lcurly({)'.S {fgp.explanation}包含字符串

解决方案

您的语法需要更正.

一般情况是: $ {#strings.abbreviate(str,10)} ,所以您需要:

< td th:text ="$ {#strings.abbreviate(fgp.explanation,10)}"> [这是我的...]</td>

I have a table and I want to change a column, the column contains a string. For example: "this is my string" --> "this is my...". I try to do this whith abbreviate().

<td th:text="${#strings.abbreviate( ${fgp.explanation}, 10)}"></td>

But I receive this error : EL1043E: Unexpected token. Expected 'rparen())' but was 'lcurly({)'. S{fgp.explanation} contains the string

解决方案

Your syntax needs to be corrected.

The general case is: ${#strings.abbreviate(str,10)} so you would want:

<td th:text="${#strings.abbreviate(fgp.explanation, 10)}">[this is my...]</td>

这篇关于我想用Thymeleaf缩写一个字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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