Simple rendering introduction to html

黄舟
Release: 2017-05-26 15:03:29
Original
3078 people have browsed it

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;
}
Copy after login

##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);
Copy after login
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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!