HTML in form doesnt work

Hello - I want to create a HTML table in the form. But the code I have doesnt work

if (identity != null) {
        // Start building the HTML table
        htmlTable.append("<table border='1' style='border-collapse: collapse; width: 100%;'>");
        htmlTable.append("<tr><th>Account Name</th><th>SAMaccountName</th> <th>Account Description</th></tr>"); // Table headers

        // Get the links (accounts) associated with this identity directly
        List links = identity.getLinks();

        // Iterate over each link to filter by application and active status
        for (Link link : links) {
            // Check for null and match application name
            if (link.getApplication() != null && "AD12".equals(link.getApplication().getName()) || "AD7".equals(link.getApplication().getName() )) {
                htmlTable.append("<tr>");
                htmlTable.append("<td>").append(link.getDisplayName()).append("</td>"); // Account Name
                htmlTable.append("<td>").append(link.getAttribute("sAMAccountName")).append("</td>"); // SAMaccountName
                htmlTable.append("<td>").append(link.getAttribute("description")).append("</td>"); //Description
                htmlTable.append("</tr>");
                
                log.info("Found AD account: " + link.getDisplayName());
            }
        }

        htmlTable.append("</table>"); 

Have you added the contentIsEscaped to true in the field where you adding the html?

<Attributes>
        <Map>
          <entry key="contentIsEscaped" value="true"/>
        </Map>
</Attributes>
5 Likes

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.