How to get the value of modelandview binding in the page

In spring MVC, the data interaction between the background and the page is carried out through modelandview, so how to obtain the value bound by modelandview in the page?

1. Get through El expression in JSP (more commonly used)

backstage:

Jsp: directly use ${name} in JSP to obtain

2. Get through JSP built-in objects

backstage:

Reception:

The above two methods are to obtain the value of modelandview binding in JSP, so how to obtain the value of modelandview binding in JS of the page?

1. The most troublesome one:

backstage:

JSP:

JS:

2. Similar to the first:

backstage:

JSP:

JS:

3. The third is relatively simple and commonly used

backstage:

JS:

In this way, you can directly get the name attribute bound in modelandview

The above discussion on obtaining the value of modelandview binding on the page is all the content shared by Xiaobian. I hope it can give you a reference and support more programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>