Как повторно устранить ошибку: метод getSubmittedFileName () не определен для типа Part - PullRequest
0 голосов
/ 09 июля 2020

Сообщение об ошибке

SEVERE: Servlet.service() for servlet [school.EditAssociate] in context with path [/school_attendance] threw exception [Servlet execution threw an exception] with root cause
java.lang.Error: Unresolved compilation problems: 
    The method getSubmittedFileName() is undefined for the type Part
    The method getSubmittedFileName() is undefined for the type Part

web. xml файл

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">

посещаемость. jsp

<td class="text-center">
<label for="ojtupload0" class="custom-file-upload">
<i class="fa fa-cloud-upload"></i>
</label> <input id="ojtupload0" type="file" style="display: none;" /> </td>
<td class="text-center"><label for="testPaperupload0" class="custom-file-upload"><i class="fa fa-cloud-upload"></i></label>
<input id="testPaperupload0" type="file" style="display: none;" /></td>

посещаемость. java

// obtains the upload file part in this multipart request
    Part filePart1 = request.getPart("OJT"+i);
    if (filePart1 != null) {
         // prints out some information for debugging
      System.out.println(filePart1.getName());
      System.out.println(filePart1.getSize());
      System.out.println(filePart1.getContentType());
      filename1 = filePart1.getSubmittedFileName(); 
      filenamecol1 = "OJTFilename";
                            //inAssTraingStat.setString(1, filenamecol1);
    inAssTraingStat.setString(11, filename1);
    System.out.println(filenamecol1);
                    

Я использую java компилятор 1.8, сервлет api 3.0, Tomcat 9, Ms Sql, JSP, JavaScript. Я получаю сообщение об ошибке: метод getSubmittedFileName () не определен для типа Part, когда я пытаюсь обновить данные или ввести данные в базу данных Sql.

любая идея по устранению проблемы. предыдущий код работал нормально, теперь, через 2 дня, я получаю эту проблему.

...