1

I'm trying to print below line on html page:

List<Map<String,Object>> someVar = someMethod();

however, in html Map<String,Object> is being treated as tag in html

Below is the output I'm getting:

List> someVar = someMethod();

everything else other than Map is being properly replaced by span tags

enter image description here

georgeawg
  • 48,608
  • 13
  • 72
  • 95

2 Answers2

2

replace < by &lt; and > by &gt;

List&lt;Map&lt;String,Object&gt;&gt; someVar = someMethod();
suvojit_007
  • 1,690
  • 2
  • 17
  • 23
  • Give this package a try: [link](http://developer.torello.directory/JavaHTML/javadoc/index.html) It can **pretty-print** a single file using the _HiLiteMe.prettyPrintScrape(file, type, style)_ method - or it can **pretty-print** an entire directory tree - using the _FileNode_ class and a call to _HiLiteMe.prettyPrintRecursiveTree(FileNode, params)_. It is based 100% off of the website http://HiLite.ME - and actually does a web-scrape to utilize their (pretty extensive) pretty-print engine. –  Oct 11 '18 at 16:02
1

try inserting \r right after the <

<script> document.write("List <\rMap<\rString,Object>> someVar = someMethod();"); </script>

the result I got was: List < Map< String,Object>> someVar = someMethod();