mardi 28 mars 2017

How to summarize a long text using Thymeleaf?

I have an object with two attributes, one is the id and the other is an attribute of the type strring called TEXT (postgres database) that is used to store the text of a post from a client.

When the application loads these posts on the page, for it does not be a text too long,I would like to summarize this text.

I was able to do this using JSP, in an easy way, using forTokens.

How to do the same as the below code using thymeleaf?

<p class="post-texto">
    <c:forTokens var="resumo" items="${p.texto}" delims=" " begin="0" end="60">
            ${resumo}
    </c:forTokens><a href="<c:url value="/${p.link}" />">[Continue lendo]</a>
</p>




Aucun commentaire:

Enregistrer un commentaire