Home > Article > Web Front-end > Simple rendering introduction to html
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!