Задать вопрос
@RuslaN0

"Класс" cannot be resolved / jsp как исправить ошибку?

Пакет:
6387962710e16387408505.png

package personal;
public class AboutMe {
    public static String getFirstName()
    {
        return "Имя";
    }
    public static String getLastName()
      {
        return "Фамилия";
    }
}


JSP:
<%@ page import="personal.AboutMe" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>

<%
    String firstName = AboutMe.getFirstName();
    String lastName = AboutMe.getLastName();
    out.print("Name: " + firstName);
    out.print("LastName: " + lastName);
%>

</body>
</html>


Выдаёт ошибку:

An error occurred at line: [14] in the generated java file: [C:\Program Files\Apache Software Foundation\Tomcat 8.5\work\Catalina\localhost\test4\org\apache\jsp\main_jsp.java]
Only a type can be imported. personal.AboutMe resolves to a package

An error occurred at line: [15] in the jsp file: [/main.jsp]
AboutMe cannot be resolved
12:
13:
14: <%
15: String firstName = AboutMe.getFirstName();
16: String lastName = AboutMe.getLastName();
17: out.print("Name: " + firstName);
18: out.print("LastName: " + lastName);

An error occurred at line: [16] in the jsp file: [/main.jsp]
AboutMe cannot be resolved
13:
14: <%
15: String firstName = AboutMe.getFirstName();
16: String lastName = AboutMe.getLastName();
17: out.print("Name: " + firstName);
18: out.print("LastName: " + lastName);
19: %>
  • Вопрос задан
  • 145 просмотров
Подписаться 1 Простой 1 комментарий
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы