작성
·
628
1
save.jsp 에서 화면에서 jsp가 제대로 등록되지 않은 같습니다.
<에러코드>
An error occurred at line: [14] in the generated java file: [C:\Users\ParkWonkyoung\AppData\Local\Temp\tomcat.8080.2915155530144798779\work\Tomcat\localhost\ROOT\org\apache\jsp\jsp\members\save_jsp.java]
Only a type can be imported. hello.servlet.domain.member.MemberRepository resolves to a package
An error occurred at line: [15] in the generated java file: [C:\Users\ParkWonkyoung\AppData\Local\Temp\tomcat.8080.2915155530144798779\work\Tomcat\localhost\ROOT\org\apache\jsp\jsp\members\save_jsp.java]
Only a type can be imported. hello.servlet.domain.member.Member resolves to a package
An error occurred at line: [6] in the jsp file: [/jsp/members/save.jsp]
MemberRepository cannot be resolved to a type
3: <%@ page contentType="text/html;charset=UTF-8" language="java" %>
4: <%
5: // request, response 사용 가능
6: MemberRepository memberRepository = MemberRepository.getInstance();
7: System.out.println("save.jsp");
8: String username = request.getParameter("username");
9: int age = Integer.parseInt(request.getParameter("age"));
An error occurred at line: [6] in the jsp file: [/jsp/members/save.jsp]
MemberRepository cannot be resolved
3: <%@ page contentType="text/html;charset=UTF-8" language="java" %>
4: <%
5: // request, response 사용 가능
6: MemberRepository memberRepository = MemberRepository.getInstance();
7: System.out.println("save.jsp");
8: String username = request.getParameter("username");
9: int age = Integer.parseInt(request.getParameter("age"));
An error occurred at line: [10] in the jsp file: [/jsp/members/save.jsp]
Member cannot be resolved to a type
7: System.out.println("save.jsp");
8: String username = request.getParameter("username");
9: int age = Integer.parseInt(request.getParameter("age"));
10: Member member = new Member(username, age);
11: System.out.println("member = " + member);
12: memberRepository.save(member);
13: %>
An error occurred at line: [10] in the jsp file: [/jsp/members/save.jsp]
Member cannot be resolved to a type
7: System.out.println("save.jsp");
8: String username = request.getParameter("username");
9: int age = Integer.parseInt(request.getParameter("age"));
10: Member member = new Member(username, age);
11: System.out.println("member = " + member);
12: memberRepository.save(member);
13: %>
Stacktrace:] with root cause
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: [14] in the generated java file: [C:\Users\ParkWonkyoung\AppData\Local\Temp\tomcat.8080.2915155530144798779\work\Tomcat\localhost\ROOT\org\apache\jsp\jsp\members\save_jsp.java]
Only a type can be imported. hello.servlet.domain.member.MemberRepository resolves to a package
An error occurred at line: [15] in the generated java file: [C:\Users\ParkWonkyoung\AppData\Local\Temp\tomcat.8080.2915155530144798779\work\Tomcat\localhost\ROOT\org\apache\jsp\jsp\members\save_jsp.java]
Only a type can be imported. hello.servlet.domain.member.Member resolves to a package
An error occurred at line: [6] in the jsp file: [/jsp/members/save.jsp]
MemberRepository cannot be resolved to a type
3: <%@ page contentType="text/html;charset=UTF-8" language="java" %>
4: <%
5: // request, response 사용 가능
6: MemberRepository memberRepository = MemberRepository.getInstance();
7: System.out.println("save.jsp");
8: String username = request.getParameter("username");
9: int age = Integer.parseInt(request.getParameter("age"));
An error occurred at line: [6] in the jsp file: [/jsp/members/save.jsp]
MemberRepository cannot be resolved
3: <%@ page contentType="text/html;charset=UTF-8" language="java" %>
4: <%
5: // request, response 사용 가능
6: MemberRepository memberRepository = MemberRepository.getInstance();
7: System.out.println("save.jsp");
8: String username = request.getParameter("username");
9: int age = Integer.parseInt(request.getParameter("age"));
An error occurred at line: [10] in the jsp file: [/jsp/members/save.jsp]
Member cannot be resolved to a type
7: System.out.println("save.jsp");
8: String username = request.getParameter("username");
9: int age = Integer.parseInt(request.getParameter("age"));
10: Member member = new Member(username, age);
11: System.out.println("member = " + member);
12: memberRepository.save(member);
13: %>
답변 2
0
안녕하세요, 인프런 AI 인턴이에요.
save.jsp 파일에서 문제가 발생한 것 같습니다. 발생한 오류 메시지를 보면 MemberRepository가 타입으로 해석되지 않는다는 내용이 포함되어 있네요. 이 오류는 MemberRepository 클래스가 제대로 import되지 않았거나, 해당 클래스를 찾을 수 없는 상황에서 발생하는 것 같습니다.
이런 경우 해결 방법으로는 다음과 같은 점을 확인해 볼 수 있어요.
1. MemberRepository 클래스가 올바른 패키지에 위치해 있는지 확인해 주세요. 잘못된 패키지 위치로 인해 클래스를 찾을 수 없는 경우 이 오류가 발생할 수 있습니다.
2. 필요한 import 문이 올바르게 선언되어 있는지 확인해 주세요. MemberRepository 클래스를 사용하기 위해 해당 클래스를 import하지 않았거나, 잘못된 import 문이 선언된 경우에도 이 오류가 발생할 수 있습니다.
위의 두 가지를 확인해 보시고 문제가 해결되지 않는다면, save.jsp 파일에 관련된 코드를 더 자세히 살펴보아야 할 것 같아요. 해당 오류가 발생하는 부분이 어떤 코드인지도 알려주시면 더 자세한 답변을 드릴 수 있을 것 같아요.
더 많은 도움이 필요하시면 언제든지 질문해주세요. 좋은 하루 보내세요!
아 그러네요 감사합니다~!