From 71bbcd2e02b4a051ddc056af01d7a30b4c25be41 Mon Sep 17 00:00:00 2001 From: Ippei Nawate <2648453+sakuna63@users.noreply.github.com> Date: Sat, 5 Feb 2022 23:50:53 +0900 Subject: [PATCH] Use IElementTag#getElementCompleteName as fallback value of type --- .../thymeleaf/spring5/processor/SpringValueTagProcessor.java | 5 ++++- .../thymeleaf/spring6/processor/SpringValueTagProcessor.java | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/thymeleaf-spring5/src/main/java/org/thymeleaf/spring5/processor/SpringValueTagProcessor.java b/thymeleaf-spring5/src/main/java/org/thymeleaf/spring5/processor/SpringValueTagProcessor.java index 7e779fa5..3759e95d 100644 --- a/thymeleaf-spring5/src/main/java/org/thymeleaf/spring5/processor/SpringValueTagProcessor.java +++ b/thymeleaf-spring5/src/main/java/org/thymeleaf/spring5/processor/SpringValueTagProcessor.java @@ -100,7 +100,10 @@ protected final void doProcess( // We will need to know the 'name' and 'type' attribute values in order to (potentially) modify the 'value' final String nameValue = tag.getAttributeValue(this.nameAttributeDefinition.getAttributeName()); - final String typeValue = tag.getAttributeValue(this.typeAttributeDefinition.getAttributeName()); + String typeValue = tag.getAttributeValue(this.typeAttributeDefinition.getAttributeName()); + if (typeValue == null) { + typeValue = tag.getElementCompleteName(); + } newAttributeValue = RequestDataValueProcessorUtils.processFormFieldValue(context, nameValue, newAttributeValue, typeValue); diff --git a/thymeleaf-spring6/src/main/java/org/thymeleaf/spring6/processor/SpringValueTagProcessor.java b/thymeleaf-spring6/src/main/java/org/thymeleaf/spring6/processor/SpringValueTagProcessor.java index 1b77fae8..55f4d73f 100644 --- a/thymeleaf-spring6/src/main/java/org/thymeleaf/spring6/processor/SpringValueTagProcessor.java +++ b/thymeleaf-spring6/src/main/java/org/thymeleaf/spring6/processor/SpringValueTagProcessor.java @@ -100,7 +100,10 @@ protected final void doProcess( // We will need to know the 'name' and 'type' attribute values in order to (potentially) modify the 'value' final String nameValue = tag.getAttributeValue(this.nameAttributeDefinition.getAttributeName()); - final String typeValue = tag.getAttributeValue(this.typeAttributeDefinition.getAttributeName()); + String typeValue = tag.getAttributeValue(this.typeAttributeDefinition.getAttributeName()); + if (typeValue == null) { + typeValue = tag.getElementCompleteName(); + } newAttributeValue = RequestDataValueProcessorUtils.processFormFieldValue(context, nameValue, newAttributeValue, typeValue);