empty object in controller from thymeleaf form

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

empty object in controller from thymeleaf form

I'm using thymeleaf for my web application. There is a problem about save and update functions. When I want to save a campaign from ui, the campaign object fields come null to rest controller class. This problem just occure in weblogic server(12.1.3). When I try it in tomcat server, do not occure any error.

my edit and create page as follow. There are a few fields for campaign, but I wrote some of them in here. Bytheway, I am sure that all fields ready in the html page. Some of them hidden, some of them visible.

<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()"

        <div class="row">
            <input type="hidden" th:field="*{id}"/>
            <input type="hidden" th:field="*{version}"/>
        <div class="row">
            <div class="input-field">
                <input id="brandname" type="text" class="validate" th:field="*{brandname}">
                <label for="brandname">Brand Name</label>

@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 (like a new object), but in tomcat server, everything is normal.