I've a web service generate code of a complete HTML, I want to integrate the generated HTML code into the view in my Play framework application. here is code in my controller:

public static void showReport(String specification) {
    String[] results= ReportRunner2.generateReport(specification); //call web service
    String output = HTMLUtil.extractBody(results[0]); //output is the complete HTML code
    render(output);
}

In my showReport.html:

#{extends 'main.html' /}
${output}

It turns out the generated HTML is not correctly rendered because the redundant <html> and <body> added from template, I've tried remove those tags in main.html but it does not work, can anyone help me?

有帮助吗?

解决方案

Try to use renderHtml(output) instead of render(output). No template will be used, just your html.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top