Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/396.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 有没有办法在控制器中获取空值,而不是空白字段的空白字符串?_Java_Spring_Null_Thymeleaf - Fatal编程技术网

Java 有没有办法在控制器中获取空值,而不是空白字段的空白字符串?

Java 有没有办法在控制器中获取空值,而不是空白字段的空白字符串?,java,spring,null,thymeleaf,Java,Spring,Null,Thymeleaf,我有一个thymeleaf表单,我想向我的底层控制器返回一个空值,而不是一个空字符串。有没有办法直接在thymeleaf中实现这一点,或者我们必须在控制器中设置转换逻辑 <div class="form-group"> <label for="note" class="formFieldTitle">Note</label> <textarea class="

我有一个thymeleaf表单,我想向我的底层控制器返回一个空值,而不是一个空字符串。有没有办法直接在thymeleaf中实现这一点,或者我们必须在控制器中设置转换逻辑

<div class="form-group">
                        <label for="note" class="formFieldTitle">Note</label>
                        <textarea class="form-control" rows="4" id="note" placeholder="Note" th:field="*{note}"
                            th:classappend="${validated == true ? (#fields.hasErrors('note') ? 'is-invalid' : 'is-valid') : ''}"
                            th:attr="readonly=${#authorization.expression('!hasAuthority(''Edit Patients'')')}">
                        </textarea>
                        <label class="errorMessage" th:if="${#fields.hasErrors('note')}" th:errors="*{note}">Note Error</label>
                    </div>

注
注释错误

这是否回答了您的问题?您是否在提交表单(POST)后询问?正确,提交表单时,我希望字段具有空值,而不是空字符串。表单是bean支持的,实体直接提供给控制器,这就是为什么我不确定在字段留空的情况下如何指示thymeleaf提供空值。