Search Results

Search found 1 results on 1 pages for 'mattblang'.

Page 1/1 | 1 

  • How can I render a Batik SVG Java object in the view portion of a Spring MVC application?

    - by mattblang
    I am creating and manipulating a SVGOMDocument object in a controller method. How can I render this object in a JSP view? I get very close with the following controller method and <object> tag. @RequestMapping(value = "/seal") public ResponseEntity<SVGDocument> createSeal() throws IOException { InputStream file = new ClassPathResource("seal.svg").getInputStream(); String parser = XMLResourceDescriptor.getXMLParserClassName(); SAXSVGDocumentFactory factory = new SAXSVGDocumentFactory(parser); SVGDocument svg = (SVGDocument) factory.createDocument("http://www.w3.org/2000/svg", file); svg.getElementById("name").getFirstChild().setNodeValue("a test name"); return new ResponseEntity<SVGDocument>(svg, HttpStatus.OK); } <object data="/seal" type="image/svg+xml"></object> This displays a string of XML that is a SVG. The string is in quotes with every XML quote escaped.

    Read the article

1