How can I make variables appear not from a new line, but into a single line?

<c:forEach items="${arr}" var="url"> ${url} </c:forEach> 
  • Do you have url's in the array contain line breaks? - a.chugunov
  • Of course not. Just in one line there will be a lot of urls. - Kleimosc
  • Then what is the problem to output in one line? - a.chugunov
  • This is part of the code. Also in for each I will have a c: url which I will not be able to get in the backend. Through js I make a string of it and output it. The only solution I saw was Kleimosc

2 answers 2

You can concatenate strings in an array and then use the value of a variable, for example:

 <c:forEach items="${arr}" var="arrUrl"> <c:set var="url" value="${url}${arrUrl}"/> </c:forEach> <c:out value="${url}"/> 

    You can remove line breaks inside the source code:

     <c:forEach items="${arr}" var="url">${url}</c:forEach>