Search code examples
javajspliferayhref

Multiple links in a tag liferay


in the database I have links, which are a property of an entity, saved on a string, separated only by a comma. Example: "www.test.com, www.test.com, www.test.com".

I can see them with this code but they are not clickable links <liferay-ui:search-container-column-text name="Links" orderable="<%=false%>" value="<%=entity.getLinks() %>"/>

Can I display them to be clickable in a <liferay-ui: search-container-column-text tag?


Solution

  • Try somethings like that:

     <liferay-ui:search-container-column-text name="Links" orderable="<%=false%>">
        <%
            String[] links = StringUtils.split(entity.getLinks());
        
            for (String link : links) {
        %>
            <a href="<%= link %>"><%= link %></a>
        <%
            }
        %>
        </liferay-ui:search-container-column-text>