开发者

what is data binding used in spring jsp views

I 开发者_开发问答can't fully understand the purpose of data binding in jsp of spring. Does someone have a full understanding of it?


You have html on one side, and java objects on the other side. You have to convert between these two. That's what binding is for - you tell spring to handle this conversion, i.e. to bind html inputs to object fields.


Classically, data binding was used within applications to take advantage of data stored in databases. Windows Forms data binding allows you to access data.

look at this www.dapfor.com


typically in a web app, data is loaded from a database. This is not done in the jsp layer (typically). The databinding is simply a way to get your data (i.e. model objects) available on the jsps.


You may want to access your input form / URL parameters in an OO fashion: input.getUserName(), input.getBirthDate(). Spring (as well as other web frameworks, but in different ways) provides you with means of transparently "binding" the input.

This binding process involves conversion (from a Strings to whatever -- Date objects, numbers, your custom classes etc.) and validation, so you get all that out of the box (all you need to do is sometimes configure it to work as you want it).


Since HTML came with stateless, binding data came to resolve that problem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜