开发者

Can you mix and match Spring form tags and regular HTML form tags in a single HTML form?

开发者 https://www.devze.com 2023-01-14 11:26 出处:网络
I have a legacy HTML form that I want to make into a Spring form. Do I need to switch all of the form tags to Spring form tags or could I mix and match them as I please?

I have a legacy HTML form that I want to make into a Spring form. Do I need to switch all of the form tags to Spring form tags or could I mix and match them as I please?

In other words, something like this:

<for开发者_如何学运维m:form modelAttribute="mymodel" action="/somecontroller/someaction" method="post">
<input type="text" name="something" value="">
</form:form>

instead of this (using only Spring form tags):

<form:form modelAttribute="mymodel" action="/somecontroller/someaction" method="post">
<form:input path="something" />
</form:form>


You can use regular <input /> elements within a <form:form /> without any problems. This is the conventional way to add submit buttons to a Spring form.

See here for more information.

0

精彩评论

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

关注公众号