I have an xml file in my computer and i want to display this xml in the browser using java. i have a jsp page and when entering this page i want to display xml file in the browser.
how can i do this in jsp page with java code.
for example, my xml path;
C:\xmlexamlpes\sample.xml
how can i display this xml in browser through jsp
Try setting the contentType to
text/xmland then write out the xml file. Sample code:Alternatively, just redirect your jsp to the xml file or provide a link to it (provided that the file is public).