When should I use html's <form> and when

2019-01-26 09:23发布

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?

2条回答
孤傲高冷的网名
2楼-- · 2019-01-26 09:53

Springs form:form tag is supposed to be used with whenever you have a formbacking object you wish to bind to the form (a model object delivered to your view).

There are no additional benefits of using the tag in a regular form with no backing object.

查看更多
ら.Afraid
3楼-- · 2019-01-26 10:08

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.

查看更多
登录 后发表回答