Home  >  Article  >  Web Front-end  >  Simple rendering introduction to html

Simple rendering introduction to html

黄舟
黄舟Original
2017-05-26 15:03:293199browse

Simple rendering introduction to html

public static String render(String pHtmlTemplate, final Map pModel) {
    PropertyPlaceholderHelper placeholderHelper = new PropertyPlaceholderHelper("${", "}");
    String result = placeholderHelper.replacePlaceholders(pHtmlTemplate, new PlaceholderResolver() {
        @Override
        public String resolvePlaceholder(String placeholderName) {
            return Objects.toString(pModel.get(placeholderName), "");
        }
    });
    return result;
}

##The above method returns an html carrying data, so Front-end js does not need to wait for ajax data before rendering.

Note: There is a sentence

1    propVal = parseStringValue(propVal, placeholderResolver, visitedPlaceholders);

in PropertyPlaceholderHelper. This code will parse the value in the model. Generally it is not needed, you can comment it out .

My practice is: a web instance of Spring+vuejs+html. (without jsp or other html templates)

The above is the detailed content of Simple rendering introduction to html. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn