Skip to content

FormTag renders empty <div> tag [SPR-16498] #21041

@spring-projects-issues

Description

@spring-projects-issues

Delete this account opened SPR-16498 and commented

The doEndTag method in org/springframework/web/servlet/tags/form/FormTag.java uses writeHiddenFields to write the ExtraHiddenFields to a <div> tag. The if statement inside writeHiddenFields checks for hiddenFields being null, but in the case of it being an empty Map will write an empty <div></div> at the end of the <form>.

Possible solutions:

  • remove encapsulating <div>, possible hidden inputs would be direct children of the <form> tag
  • check hiddenFields not only for null but also for empty keyset in the if condition

Affects: 4.3.14

Referenced from: commits 350f318, 6d75732

Backported to: 4.3.15

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)status: backportedAn issue that has been backported to maintenance branchestype: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions