Search code examples
liferayliferay-6

Include new line character in value attribute of Liferay search container


I have the following line of code of search container. I want to include a new line between the two values that I want to display..

<liferay-ui:search-container-column-text name='Employee Name'
      value='<%=String.valueOf(search.getEmpFname()) +  String.valueOf(search.getEmpLname()) +"\n" + String.valueOf(search.getEmpTitle()) %>'
      href="" >

The reason I want it this way is that I want all these values in one box each row.

So how should I format the above code so that I have:

 String.valueOf(search.getEmpFname()) +  String.valueOf(search.getEmpLname()) 

on one line and

  String.valueOf(search.getEmpTitle())

on the next line of the same row.


Solution

  • Converting my comment as an answer:

    You can try using <br> tag instead of "\n" like this:

    String.valueOf(search.getEmpLname()) + "<br>" + String.valueOf(search.getEmpTitle()`
    

    or you can use <liferay-ui:search-container-column-jsp tag instead of <liferay-ui:search-container-column-text tag

    or else use the tag as following:

    <liferay-ui:search-container-column-text name='Employee Name' href="">
       <%=String.valueOf(search.getEmpFname()) + String.valueOf(search.getEmpLname()) %>
       <br>
       <%= String.valueOf(search.getEmpTitle()) %>
    </liferay-ui:search-container-column-text>*emphasized text**emphasized text*