Java Magazine, July/August 2018
ORACLE COM JAVAMAGAZINE JULY AUGUST 2018 36 libraries If you want to generate a custom HTML snippet inside a div generated by the div method you can use the rawHtml method as shown in Listing 14 Listing 14 div rawHtml p I like em HTML em p The method creates an instance of the UnescapedText class which is a wrapper class for the text representation see Figure 1 Handling JavaScript and CSS Resources TagCreator provides style and script methods to create style and script HTML tags respectively A sample that includes resources is shown in Listing 15 Listing 15 script rawHtml alert ok style rawHtml body background color blue TagCreator also provides static methods for loading JavaScript and CSS resources directly from files I show this in Listing 16 The methods sufixed with _ min provide the ability to minify the content while transforming it into a string representation
You must have JavaScript enabled to view digital editions.