I have a JSF data table that is displaying data based off a search successfully. However, I’m not sure how to selectively bold certain text data in a particular column.
So, for instance, I would like this text…
Here is some text that would be inside the h:column
to show up like this on the page…
Here is some text that would be inside the h:column
Here’s what my data table looks like
Results:
<h:dataTable var="results"
value="#{logSearcherBean.results}"
border="1">
<h:column>#{results.logName}</h:column>
<h:column>#{results.matchLine}</h:column>
</h:dataTable>
You could either homebrew an EL function which manipulates the column value and returns the desired HTML,
(note that this is due to
escape="false", which is mandatory to present HTML literally, also sensitive to XSS attacks if thelogNameis a value which is fully controlled by the enduser)Or grab JavaScript/jQuery which manipulates the returned HTML, see also this related question: Highlight a word with jQuery.