javaspringmodel-view-controllernewlinejspx

how to make a new line in a tag table (Spring MVC)?


I have troubles with putting a newLine in a Java String sended to a .jspx file. I have a table and in a cell i want display the content of the string received from the controller as :

|-------|
| aaa |
| bbb |
|-------|

instead i get this:
|-----------|
|aaa bbb |
|-----------|
with wrote the br tag between aaa and bbb (i have to write it here because else this site does a newLine in my example..)

The code in the java controller is:

   String a = "aaa";
   String b = "bbb";
   String cell= a +"<br/>"+ b;
   model.addAttribute("cell",cell);

I tried also (instead of the br tag) "\n " "\r\n" and "System.getProperty("line.separator")" without success

in the .jspx i got:

 <table:table>
   <table:column id="firstCellId" property="cell">
   ...
   <table:column id="secondCellId" property="another column">//others tr cell of no importance..
    <table:column id="secondCellId" property="another column">//others tr cell of no importance..
 </table:table>

Is there any way to modify the cell without using the CSS?


Solution

  • It was caused by:

    htmlEscape="false"

    in the tag table. I've removed it and now it works.

    I don't know how to close this question.