Spring boot thymeleaf image upload web project root directory operation steps
Thymeleaf introduction
In short, thymeleaf is a template engine similar to velocity and FreeMarker, which can completely replace JSP. Compared with other template engines, it has the following three attractive features:
1. Thymeleaf can run in both network and non network environments, that is, it allows artists to view the static effect of the page in the browser and programmers to view the dynamic page effect with data in the server. This is because it supports HTML prototypes, and then adds additional attributes in HTML tags to achieve the presentation of template + data. When the browser interprets HTML, it ignores undefined tag attributes, so the thymeleaf template can run statically; When data is returned to the page, the thymeleaf tag will dynamically replace the static content to make the page display dynamically.
2. Out of the box features of thymeleaf. It provides two dialects: standard and spring standard. You can directly apply templates to achieve the effect of JSTL and ognl expressions, so as to avoid the trouble of setting templates, JSTL and changing labels every day. At the same time, developers can also extend and create custom dialects.
3. Thymeleaf provides spring standard dialect and an optional module perfectly integrated with spring MVC, which can quickly realize form binding, Attribute Editor, internationalization and other functions.
Form upload:
Supplementary: is there any difference between variable expression and asterisk expression?
If the context is not considered, there is no difference between the two; Asterisk syntax evaluation is expressed on the selected object, not the whole context. What is the selected object? Is the value of the parent tag, as follows:
This is completely equivalent to:
Of course, the dollar sign and asterisk syntax can be mixed:
summary
The above is the operation steps of uploading spring boot thymeleaf pictures to the root directory of the web project introduced by Xiaobian. I hope it will be helpful to you. If you have any questions, please leave me a message, and Xiaobian will reply to you in time. Thank you very much for your support for the programming tips website!