웹 응용 프로그램에 thymeleaf를 사용하고 있습니다. 저장 및 업데이트 기능에 문제가 있습니다. UI에서 캠페인을 저장하려고 할 때 캠페인 객체 필드는 컨트롤러 클래스를 종료하기 위해 null이됩니다. 이 문제는 weblogic 서버에서만 발생합니다 (12.1.3). 내가 Tomcat 서버에서 시도 할 때 어떤 오류도 발생하지 않습니다.Thymeleaf 양식이 null 필드가있는 객체를 weblogic 서버의 컨트롤러에 보냅니다.
내 편집 및 생성 페이지는 다음과 같습니다. 캠페인을위한 몇 가지 필드가 있지만 여기에 그 중 일부를 썼습니다. Bytheway, html 페이지에서 모든 필드를 사용할 준비가되었습니다. 그들 중 일부는 숨겨졌으며 일부는 눈에 띄었다.
<div class="row">
<form name="Form" class="col s8 offset-s2" id="upload-file-form"
enctype="multipart/form-data" th:object="${campaign}"
th:action="@{/admin/getCampaign}" onsubmit="return validateForm()"
method="post">
<div class="row">
<input type="hidden" th:field="*{id}"/>
<input type="hidden" th:field="*{version}"/>
</div>
<div class="row">
<div class="input-field">
<input id="brandname" type="text" class="validate" th:field="*{brandname}">
<label for="brandname">Brand Name</label>
</div>
</div>
</form>
</div>
@RequestMapping(value = "admin/getCampaign", method = RequestMethod.POST)
public String uploadingPost(@RequestParam("uploadingFiles") MultipartFile[] uploadingFiles,
@RequestParam("uploadingFiles1") MultipartFile[] uploadingFiles1,
@RequestParam("uploadingFiles2") MultipartFile[] uploadingFiles2,
@RequestParam("uploadingFiles3") MultipartFile[] uploadingFiles3,
Campaign campaign) throws IOException {
/** this is my controller method for save or update.
*/
}
in weblogic server campaign parameter fields come null (as a new object), but in tomcat server, everything is normal.
업데이트 :
나는 this 후 같은 가치를 내 UI 필드를 변경했습니다. 그러나 문제는 계속됩니다.
<input type="hidden" th:value="*{id}"/>
어떤 thymeleaf 버전을 사용하고 있습니까? – Antoniossss
spring-boot-starter-thymeleaf (1.5.7.release)를 사용하고 있습니다. –