인프런 커뮤니티 질문&답변

ujujo@naver.com님의 프로필 이미지

작성한 질문수

누구나 따라하면서 배우는 JSP 커뮤니티 게시판 만들기

4강에서 로그인페이지 아이디 비번 입력하고 넘어가는 부분에서 에러가납니다

19.06.27 16:57 작성

·

324

0

아이디랑 비번을 치면 넘어가야하는데

자꾸 에러가나요ㅠㅠ 에러는

HTTP Status 500 – Internal Server Error


Type Exception Report

Message Can't find a method to write property [userID] of type [java.lang.String] in a bean of type [user.User]

Description The server encountered an unexpected condition that prevented it from fulfilling the request.

Exception

org.apache.jasper.JasperException: Can't find a method to write property [userID] of type [java.lang.String] in a bean of type [user.User]
	org.apache.jasper.runtime.JspRuntimeLibrary.introspecthelper(JspRuntimeLibrary.java:321)
	org.apache.jsp.loginAction_jsp._jspService(loginAction_jsp.java:125)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:476)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:386)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:330)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

Note The full stack trace of the root cause is available in the server logs.


Apache Tomcat/8.5.41

 

이렇게 뜹니다 

 

 

제코드는 똑같이헀는데요..

 

package user;

 

public class User {

 

private String userID;

private String userPassword;

private String userName;

private String userGender;

private String userEmail;

 

public String getUserID() {

return userID;

}

 

public void setUserId(String userID) {

this.userID = userID;

}

public String getUserPassword() {

return userPassword;

}

public void setUserPassword(String userPassword) {

this.userPassword = userPassword;

}

public String getUserName() {

return userName;

}

public void setUserName(String userName) {

this.userName = userName;

}

public String getUserGender() {

return userGender;

}

public void setUserGender(String userGender) {

this.userGender = userGender;

}

public String getUserEmail() {

return userEmail;

}

public void setUserEmail(String userEmail) {

this.userEmail = userEmail;

}

 

 

}

//loginAction

 

<%@ page language="java" contentType="text/html; charset=UTF-8"

    pageEncoding="UTF-8"%>

<%@ page import="user.UserDAO" %>

<%@ page import="java.io.PrintWriter" %>

<% request.setCharacterEncoding("UTF-8"); %>

<jsp:useBean id ="user" class="user.User" scope="page"/>

<jsp:setProperty name ="user" property="userID"/>

<jsp:setProperty name="user" property="userPassword"/>

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title>JSP web board page</title>

</head>

<body>

<%

UserDAO userDAO = new UserDAO();

int result = userDAO.login(user.getUserID(), user.getUserPassword());

if (result == 1){

PrintWriter script = response.getWriter();

script.println("<script>");

script.println("location.href = 'main.jsp'");

script.println("</script>");

}else if(result == 0){

PrintWriter script = response.getWriter();

script.println("<script>");

script.println("alert('Invalid Password')");

script.println("history.back()");

script.println("</script>");

}

else if(result == -1){

PrintWriter script = response.getWriter();

script.println("<script>");

script.println("alert('User ID doesn't exist')");

script.println("history.back()");

script.println("</script>");

}

else if(result == -2){

PrintWriter script = response.getWriter();

script.println("<script>");

script.println("alert('Database error is occured')");

script.println("history.back()");

script.println("</script>");

}

%>

</body>

</html>

대체 뭐가 문제인걸까요?

답변

답변을 기다리고 있는 질문이에요
첫번째 답변을 남겨보세요!