Skip to content

Commit c7d0054

Browse files
committed
Remove closing tag in form tag's extra hidden fields
The fields returned from a RequestDataValueProcessor are now written as hidden fields without a closing tag. Before: <input type="hidden" name="xxx" value="yyy"></input> After: <input type="hidden" name="xxx" value="yyy" /> Issue: SPR-10103
1 parent 2ac4a8c commit c7d0054

File tree

2 files changed

+3
-3
lines changed
  • spring-webmvc/src

2 files changed

+3
-3
lines changed

spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/FormTag.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -469,8 +469,8 @@ private void writeHiddenFields(Map<String, String> hiddenFields) throws JspExcep
469469
if (hiddenFields != null) {
470470
for (String name : hiddenFields.keySet()) {
471471
this.tagWriter.appendValue("<input type=\"hidden\" ");
472-
this.tagWriter.appendValue("name=\"" + name + "\" value=\"" + hiddenFields.get(name) + "\">");
473-
this.tagWriter.appendValue("</input>\n");
472+
this.tagWriter.appendValue("name=\"" + name + "\" value=\"" + hiddenFields.get(name) + "\" ");
473+
this.tagWriter.appendValue("/>\n");
474474
}
475475
}
476476
}

spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/FormTagTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ public void testRequestDataValueProcessorHooks() throws Exception {
293293

294294
String output = getOutput();
295295

296-
assertEquals("<input type=\"hidden\" name=\"key\" value=\"value\"></input>", getInputTag(output));
296+
assertEquals("<input type=\"hidden\" name=\"key\" value=\"value\" />", getInputTag(output));
297297
assertFormTagOpened(output);
298298
assertFormTagClosed(output);
299299

0 commit comments

Comments
 (0)