页面.ftl: <input id="fileData" name="fileData" type="file"/>
后台JAVA代码: import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.List; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartHttpServletRequest;
public String addJfItemImage(HttpServletRequest request) { MultipartFile formFile = ((MultipartHttpServletRequest) request).getFil("fileData"); }