다음 코드에서 java spring을 사용하여 컨트롤러에 양식을 제출하려고합니다. 파일 요소를 성공적으로 추적하지만 다른 요소를 검색하는 방법을 알지 못합니다 (짧은 이름 및 전체 이름) 값. 나를 도와주세요.컨트롤러에서 양식 요소를 검색하는 방법
<body>
<div style="text-align: center; margin-top: 60px;">
<form action="upload" enctype="multipart/form-data">
<input type="hidden" id="shortName" name="michael">
<input type="hidden" id="fullName" name="michael jackson">
Select file:
<input type="file" name="dataFile" id="fileAttachment"/><br/><br/>
<div style="text-align: center; margin-top: 100px;">
<input style="cursor: pointer;" onmouseover="" onclick="uploadAttachment()" class="dialogbox" type="submit" value="Upload Report" />
</div>
</form>
</div>
</body>
컨트롤러 측 코드 : 컨트롤러에서
@RequestMapping(value = "upload", method=RequestMethod.POST)
public void upload(HttpServletRequest request, HttpServletResponse response,
@RequestPart("dataFile") MultipartFile file
){
System.out.println(file.getSize());
}
'@RequestParam String shortName'과'@RequestParam String fullName'을 사용해 보셨습니까? – sp00m
예, 귀하의 구문을 시도했지만 그 도움이 도움이됩니다. 답장을 보내 주셔서 감사합니다. – b22