I'm trying to submit list of checkboxes along with file to my controller with following code:
<form:form enctype="multipart/form-data" modelAttribute="uploadItem" method="post" action="/image/upload">
<form:label for="fileData" path="filename">Photo:</form:label>
<input class="filePhoto" type="file" name="fileData" id="fileData" /><br>
<input type="submit" value="Submit!" /><br>
<c:forEach items="${tags}" var="tag">
<form:checkbox path="tagList" value="${tag.tagId}" label="${tag.name}"/><br>
</c:forEach>
<form:textarea path="description" label="description"/>
<img id="blah" src="#" alt="Preview" width="300" />
</form:form>
My problem is that when it gets converted to my List<String>
, it is in form of
null, null, null, on, null, null, on
where on
are checked checkboxes and null
are those unchecked. What I need is id's of those checkboxes instead of on
because I don't know what exactly is on
Let me know what other information is needed. List of checkboxes is passed to controller so I don't think form snippets are relevant here, I think its more of an JSP issue
Aucun commentaire:
Enregistrer un commentaire