什么时候应该使用html的< form>当spring的< form:form>在Spring MVC的Web应用程序? [英] When should I use html's <form> and when spring's <form:form> in Spring MVC web app?

查看:128
本文介绍了什么时候应该使用html的< form>当spring的< form:form>在Spring MVC的Web应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当你需要它们提供的功能时,使用Spring表单:
$ b


  • 绑定到对象


  • 重新显示错误值

  • 错误消息的绑定



对于简单的表单(例如每个页面上的简单搜索框),您通常不需要这些功能 - 因此您可以使用简单的HTML表单。


I am wondering is it good practice to write all forms in spring tags or can I mix spring form tags with html form tags?

解决方案

Use Spring forms when you need functionality provided by them:

  • binding to objects
  • configurable field formatting
  • redisplay of values on errors
  • binding of error messages

For simple forms (such as a simple search box on each page) you usually don't need these features - therefore you can use simple HTML forms for them.

这篇关于什么时候应该使用html的< form>当spring的< form:form>在Spring MVC的Web应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆