Document is a Java object. It doesn't make sense to return a Java object in a browser. Instead you would return the XML character data to the user for display. (Also, this is better done in a servlet than a JSP. JSP is about presentation.)
Hi,
I have not done for xml
But if you want a json object you can use json tag library in jsp to create a json object.
Which will get by the request from the browser.