inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

묻고 답해요

173만명의 커뮤니티!! 함께 토론해봐요.

jsp) 자바빈으로 값 전달이 안 되고 null로 뜨는 문제

미해결

이런 식으로 됩니다. join.jsp에서 회원가입 정보를 작성하고 등록 버튼을 누르면 join_process.jsp로 이동하는 방식입니다. joinBean.java와 joinBean.class 파일은 [톰캣경로/webapps/java_web_last/WEB-INF/classes/com/test]에 있고 다른 jsp 파일은 [톰캣경로/webapps/java_web_last]에 있습니다. vscode로 작업하고 있구요, 위치가 잘못된 걸까요? 뤼튼에 물어볼 때마다 코드는 문제가 없다고 뜨거든요. 코드도 함께 첨부합니다. 잘 아시는 분들 도움 부탁드립니다. ㅠㅠ join.jsp join_process.jsp <%@ page contentType="text/html; charset=UTF-8"%> <%@ page import="com.test.joinBean" %> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <jsp:useBean id="joinBean" class="com.test.joinBean" scope="request" /> <jsp:setProperty name="joinBean" property="*" /> <html> <head> <title>회원 가입 확인</title> <link rel="stylesheet" href="bootstrap.min.css" /> </head> <body> <div class="container py-4"> <jsp:include page="/menu.jsp" /> <div class="p-5 mb-4 bg-body-tertiary rounded-3"> <div class="container-fluid py-5"> <h1 class="display-5 fw-bold">회원 가입 확인</h1> <p class="col-md-8 fs-4">Please confirm your registration information.</p> </div> </div> <div class="row align-items-md-stretch text-center"> <table class="table table-striped"> <tr> <th>아이디</th> <td><jsp:getProperty name="joinBean" property="id" /></td> </tr> <tr> <th>비밀번호</th> <td><jsp:getProperty name="joinBean" property="password" /></td> </tr> <tr> <th>성명</th> <td><jsp:getProperty name="joinBean" property="name" /></td> </tr> <tr> <th>성별</th> <td><jsp:getProperty name="joinBean" property="gender" /></td> </tr> <tr> <th>생일</th> <td><jsp:getProperty name="joinBean" property="birthyy" />년 <jsp:getProperty name="joinBean" property="birthmm" />월 <jsp:getProperty name="joinBean" property="birthdd" />일</td> </tr> <tr> <th>이메일</th> <td><jsp:getProperty name="joinBean" property="mail1" />@<jsp:getProperty name="joinBean" property="mail2" /></td> </tr> <tr> <th>전화번호</th> <td><jsp:getProperty name="joinBean" property="phone" /></td> </tr> <tr> <th>주소</th> <td><jsp:getProperty name="joinBean" property="postcode" /> <jsp:getProperty name="joinBean" property="addr1" /> <jsp:getProperty name="joinBean" property="addr2" /></td> </tr> </table> <div class="mb-3 row"> <div class="col-sm-12"> <div class="d-flex justify-content-center"> <form action="join_complete.jsp" method="post"> <input type="hidden" name="id" value="<jsp:getProperty name="joinBean" property="id" />"> <input type="hidden" name="password" value="<jsp:getProperty name="joinBean" property="password" />"> <input type="hidden" name="name" value="<jsp:getProperty name="joinBean" property="name" />"> <input type="hidden" name="gender" value="<jsp:getProperty name="joinBean" property="gender" />"> <input type="hidden" name="birthyy" value="<jsp:getProperty name="joinBean" property="birthyy" />"> <input type="hidden" name="birthmm" value="<jsp:getProperty name="joinBean" property="birthmm" />"> <input type="hidden" name="birthdd" value="<jsp:getProperty name="joinBean" property="birthdd" />"> <input type="hidden" name="mail1" value="<jsp:getProperty name="joinBean" property="mail1" />"> <input type="hidden" name="mail2" value="<jsp:getProperty name="joinBean" property="mail2" />"> <input type="hidden" name="phone" value="<jsp:getProperty name="joinBean" property="phone" />"> <input type="hidden" name="postcode" value="<jsp:getProperty name="joinBean" property="postcode" />"> <input type="hidden" name="addr1" value="<jsp:getProperty name="joinBean" property="addr1" />"> <input type="hidden" name="addr2" value="<jsp:getProperty name="joinBean" property="addr2" />"> <button type="submit" class="btn btn-primary me-2"> <span class="d-flex justify-content-center align-items-center"> 이대로 회원가입 </span> </button> </form> <a href="join.jsp" class="btn btn-primary"> <span class="d-flex justify-content-center align-items-center"> 돌아가기 </span> </a> </div> </div> </div> </div> <jsp:include page="/footer.inc.jsp" /> </div> </body> </html> joinBean.java package com.test; public class joinBean { private String id; private String password; private String name; private String gender; private String birthyy; private String birthmm; private String birthdd; private String mail1; private String mail2; private String phone; private String postcode; private String addr1; private String addr2; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getGender() { return gender; } public void setGender(String gender) { this.gender = gender; } public String getBirthyy() { return birthyy; } public void setBirthyy(String birthyy) { this.birthyy = birthyy; } public String getBirthmm() { return birthmm; } public void setBirthmm(String birthmm) { this.birthmm = birthmm; } public String getBirthdd() { return birthdd; } public void setBirthdd(String birthdd) { this.birthdd = birthdd; } public String getMail1() { return mail1; } public void setMail1(String mail1) { this.mail1 = mail1; } public String getMail2() { return mail2; } public void setMail2(String mail2) { this.mail2 = mail2; } public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } public String getPostcode() { return postcode; } public void setPostcode(String postcode) { this.postcode = postcode; } public String getAddr1() { return addr1; } public void setAddr1(String addr1) { this.addr1 = addr1; } public String getAddr2() { return addr2; } public void setAddr2(String addr2) { this.addr2 = addr2; } } null로 표시되는 것 말고 따로 오류 뜨는 건 없습니다. 자바빈 파일이 연결이 안 되는 것 같은데...

  • jsp
  • java
  • javabean
임서하 댓글 2 좋아요 0 조회수 392

인기 태그

인프런 TOP Writers

주간 인기글