I am trying to write a couple of small html lines in my java class that gets some data from another API. I get the data in a JSON string and would like to display some of it on a web page.
To create HTML, I try:
StringBuilder sb = new StringBuilder(); for(int i=0;i<leads.size();i++){ sb.append("<p>Name: "+leads.get(i).getFirstName()+" "+leads.get(i).getLastName()+"</p>"); sb.append("<p>Email: "+leads.get(i).getEmail()+"</p>"); sb.append("<br />"); } fullLeadData = sb.toString();
But what is ultimately displayed is a literal interpretation of the html tags. Is there a way I can create this string so that the tags remain as tags and not escaped characters?
The java class is a managed bean, so in html I have:
<body> <div id="display"> #{PortalView.fullLeadData} </div> </body>
Where fullLeadData is a line with html.
Webster gordon
source share