Pergunta

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?

Foi útil?

Solução

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

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top