I have written the following method that returns string with rendered HTML of the view:
public String getViewAsString(String viewName, Map