2
I’m in an e-commerce project, and I need to display a product name. I’m thinking of using a label for this. The idea is to leave x characters visible, if the title exceeds this number x of characters, display "...". I don’t know how to do this, nor if the best option or if it is possible with a label.
Remarks: I am using jsp to recover the product title of the database. The programming language is JAVA and use html and jsp. I can recover the name with <%anuncio.getTitulo()%>
.
Any tips or suggestions on how to do this?
If I understand correctly, when the title of the ad you’re picking up through the
<%anuncio.getTitulo%>
outnumber X of letters will be displayed...
in the title, that?– R.Santos
If that’s what you want to do, play your get back
<%anuncio.getTitulo%>
within a string variable and use the methodlength()
that returns the number of letters of a variable String, make a condition, if this number returned exceeds the number of letters you want just have display...
else displays<%anuncio.getTitulo%>
even– R.Santos