반응형

Js.html 영역

 

 

1. 기존의 회원가입 jsp부분의 HTML 파일

<div class="modal fade" id="sign-up" role="dialog">
	<div class="modal-dialog">

		<!-- Modal content-->
		<div class="modal-content">
			<div class="modal-header">
				<h4 class="modal-title">
					<span style="color: #643691;">Spring</span> 회원 가입
				</h4>
				<button type="button" class="close" data-dismiss="modal">×</button>

			</div>

			<div class="modal-body">


				<table
					style="cellpadding: 0; cellspacing: 0; margin: 0 auto; width: 100%">
					<tr>
						<td style="text-align: left">
							<p>
								<strong>아이디를 입력해주세요.</strong>&nbsp;&nbsp;&nbsp;<span id="idChk"></span>
							</p>
						</td>


					</tr>
					<tr>
						<td><input type="text" name="userId" id="user_id"
							class="form-control tooltipstered" maxlength="14"
							required="required" aria-required="true"
							style="margin-bottom: 25px; width: 100%; height: 40px; border: 1px solid #d9d9de"
							placeholder="숫자와 영어로 4-10자"></td>

					</tr>

					<tr>
						<td style="text-align: left">
							<p>
								<strong>비밀번호를 입력해주세요.</strong>&nbsp;&nbsp;&nbsp;<span id="pwChk"></span>
							</p>
						</td>
					</tr>
					<tr>
						<td><input type="password" size="17" maxlength="20"
							id="password" name="userPw" class="form-control tooltipstered"
							maxlength="20" required="required" aria-required="true"
							style="ime-mode: inactive; margin-bottom: 25px; height: 40px; border: 1px solid #d9d9de"
							placeholder="영문과 특수문자를 포함한 최소 8자"></td>
					</tr>
					<tr>
						<td style="text-align: left">
							<p>
								<strong>비밀번호를 재확인해주세요.</strong>&nbsp;&nbsp;&nbsp;<span
									id="pwChk2"></span>
							</p>
						</td>
					</tr>
					<tr>
						<td><input type="password" size="17" maxlength="20"
							id="password_check" name="pw_check"
							class="form-control tooltipstered" maxlength="20"
							required="required" aria-required="true"
							style="ime-mode: inactive; margin-bottom: 25px; height: 40px; border: 1px solid #d9d9de"
							placeholder="비밀번호가 일치해야합니다."></td>
					</tr>

					<tr>
						<td style="text-align: left">
							<p>
								<strong>이름을 입력해주세요.</strong>&nbsp;&nbsp;&nbsp;<span id="nameChk"></span>
							</p>
						</td>
					</tr>
					<tr>
						<td><input type="text" name="userName" id="user_name"
							class="form-control tooltipstered" maxlength="6"
							required="required" aria-required="true"
							style="margin-bottom: 25px; width: 100%; height: 40px; border: 1px solid #d9d9de"
							placeholder="한글로 최대 6자"></td>
					</tr>

					<tr>
						<td style="padding-top: 10px; text-align: center">
							<p>
								<strong>회원가입을 환영합니다~~!</strong>
							</p>
						</td>
					</tr>
					<tr>
						<td style="width: 100%; text-align: center; colspan: 2;"><input
							type="button" value="회원가입" class="btn form-control tooltipstered"
							id="signup-btn"
							style="background-color: #643691; margin-top: 0; height: 40px; color: white; border: 0px solid #388E3C; opacity: 0.8">
						</td>
					</tr>

				</table>

			</div>
		</div>
	</div>
</div>

</div>

 

 

2. 패스워드 입력값 검증을 위한 Js코드

 

 

         const getIdCheck = RegExp(/^[a-zA-Z0-9]{4,14}$/);
         const getPwCheck = RegExp(/([a-zA-Z0-9].*[!,@,#,$,%,^,&,*,?,_,~])|([!,@,#,$,%,^,&,*,?,_,~].*[a-zA-Z0-9])/);
         const getNameCheck = RegExp(/^[가-힣]+$/);
         
         
          $('#password').keyup(function() {
		
    	  //비밀번호 란에 공백 확인 
    	  if($(this).val() === ''){
    		  $(this).css('background-color', 'pink');
		 	  $('#pwChk').html('<b style="font-size: 14px; color: red">[비밀번호는 필수 정보 입니다..]</b>');
		 	  chk2 = false;
    	  }
    	  
    	  //비밀번호 유효성 검사 
    	  else if(!getPwCheck.test($(this).val()) || $(this).val().length < 8){
    		  $(this).css('background-color', 'pink');
		 	  $('#pwChk').html('<b style="font-size: 14px; color: red">[특수 문자 포함 8글자 이상 !]</b>');
		 	 chk2 = false;
    	  }// 통과
    	  else{
    		  $(this).css('background-color', 'aqua');
		 	  $('#pwChk').html('<b style="font-size: 14px; color: green">[비밀번호 입력 완료!]</b>');
		 	 chk2 = true;
    	  }
    	  
	});

 

위의 const getpwcheck로 코드로 비밀번호의 유효성 검사를 한다.

 

3. 비밀번호 확인란 검증

 

//3. 비밀번호 확인란 입력 검증 
$('#password_check').keyup(function() {
// 비밀번호 확인란 검증 
if($(this).val() === ''){
	$(this).css('background-color', 'pink');
	$('#pwChk2').html('<b style="font-size: 14px; color: red">[비밀번호는 확인은 필수 정보 입니다.]</b>');
	chk3 = false;
	}
	/ 비밀번호 확인란 유효성 검사.
	else if($(this).val() != $('#password').val()){
	 $(this).css('background-color', 'pink');
	 $('#pwChk2').html('<b style="font-size: 14px; color: red">[비밀번호가 일치하지 않습니다.]</b>');
	 chk3 = false;
	}else{
	 $(this).css('background-color', 'aqua');
	 $('#pwChk2').html('<b style="font-size: 14px; color: green">[비밀번호 입력 확인 완료]</b>');
	chk3 = true;
}

 

 

4. 이름 입력값 검증

 

		$('#user_name').keyup(function() {
			if($(this).val === ''){
				 $(this).css('background-color', 'pink');
			 	 $('#nameChk').html('<b style="font-size: 14px; color: red">[이름은 필수 정보 입니다. ]</b>');
			 	 chk4 = false;
			}else if(!getNameCheck.test($(this).val())){
				 $(this).css('background-color', 'pink');
			 	 $('#nameChk').html('<b style="font-size: 14px; color: red">[이름은 한글 이외에 다른 값은 입력 할 수 없습니다. ]</b>');
			 	 chk4 = false;
			}else{
				$(this).css('background-color', 'aqua');
			 	 $('#nameChk').html('<b style="font-size: 14px; color: red">[이름 입력 완료! ]</b>');
			 	 chk4 = true;
			}
		}); //이름 입력 끝

5. 회원가입 

 

$('#signup-btn').click(function() {
			
			if(chk1 && chk2 && chk3 && chk4){
				
				//Id정보 
				const id = $("#user_id").val();
				//pw정보
				const pw = $('#password').val();
				//name
				const name = $('#user_name').val();
				//프로퍼티 이름은 반드시 userVO와 같아야 동작이 된다!! 매우 중요!
				const user ={
						"account" : id,
						"password" : pw,
						"name" : name
						// json 아님
				}
				
				// 비동기 통신 시작! 
				$.ajax({
					type : "post",
					url : "/user/",
					contentType : "application/json",
					dataType : "text",
					// 자바스크립트 객체를 json문자열로 변환해 주는 메소드
					data : JSON.stringify(user),
					success : function(result) {
						console.log("통신 성공" + result);
						alert('회원가입을 축하합니다.');
						location.href ="/";
					},
					error : function() {
						alert('회원가입 실패!');
					}
				})
			}else {
				alert('입력정보를 확인 해 주세요.');
			}
			
		})/

사용자가 회원 가입 버튼을 눌렀을 때 이벤트 처리 및 사용자가 입력하는 4가지 데이터 

(ID, PASSWORD, PASSWORD_CHECK, NAME ) 가 모두 일치해야 된다.

 

이때 ajax에서 url user쪽 컨트롤러로 const user의 정보의 객체에 담아 json 형식으로 요청을 보내게 된다.

 


스프링 영역

 

6. 컨트롤러 작성

 

	@PostMapping("/")
	public String register(@RequestBody UserVO vo) {
		System.out.println("/user/ : post");
		serivce.register(vo);
		return "joinSuccess";
	}

 

 

ajax에서 user객체를 담아 컨트롤러로 보내주어 @RequestBody의 어노테이션으로 UserVO를 전달 받아

service 쪽으로 넘기게 된다. 

 

7. 서비스 작성

 

	public void register(UserVO vo) {
		//회원 비밀번호를 암호화 인코딩
		BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();
		System.out.println("암호화 하기 전 비번 : " + vo.getPassword());
		
		//비밀번호를 암호화 해서 user객체에 다시 저장하기.
		String securepw = encoder.encode(vo.getPassword());
		System.out.println("암호화 후 비번 : " + securepw);
		vo.setPassword(securepw);
		
		mapper.register(vo);
	}

이때 스프링의 메이븐 API인 회원 비밀번호를 암호화 하여 저장한다. 

사용 Api 명은 Spring Security이다 사용방법은 나중에 포스팅 하도록 겠다. 

 

4,5번은 암호화를 진행한 패스워드 6번은 암호화 미적용

다만 주의할 점은 암호화를 할 경우에 암호화 이전에 만들었던 아이디와 패스워드로는 로그인이 불가능하다.

 

이제 서비스에서 Mapper.register 쪽으로  User의 값을 전달한다.

 

	void register(UserVO vo);

이제 회원 가입을 할 xml을 만들자

 

8. Mapper.xml 작성

 

 <mapper namespace="com.spring.mvc.user.repository.IUserMapper">
    
    <resultMap type="com.spring.mvc.user.model.UserVO" id="UserMap">
    	<result property="regDate" column="reg_date"/>
    	<result property="sessionId" column="session_id"/>
    	<result property="limitTime" column="limit_time"/>
    </resultMap>
    
     	<insert id="register">
     	iNSERT INTO mvc_user
		(account,password,name)
		VALUES(#{account},#{password},#{name})
     	</insert>

 

코드블럭에는 xml이 없구낭... 

 

mapper의 namespace에는 직전에 작성하였던 IuserMapper의 경로를 넣어준다. 

 

이때 데이터베이스의 컬럼명과 VO객체의 변수명의 이름이 다를 때 ResultMap 이라는 태그를 작성해야한다. 

property ="UserVO의 변수명" column ="DB의 컬럼명" 을 작성해 준다.

 

단 이것은 Select문에서 적용한다 

Insert에서는 사용하지 않는다 하지만  미리 작성해서 나쁠건 없다.

 

 


 

8. 최종 동작 확인 

 

ㅇ ㅏ.. ajax에서 404에러다.. 

컨트롤러에서 리퀘스트바디나 url 문제같은데.. 

 

다했는데.. 

 

다음 포스팅은 아마도 오류 해결을 해야할거같다..

반응형
반응형

1. 회원가입 html을 작성 

<!-- 회원가입 Modal -->
<div class="modal fade" id="sign-up" role="dialog">
	<div class="modal-dialog">

		<!-- Modal content-->
		<div class="modal-content">
			<div class="modal-header">
				<h4 class="modal-title">
					<span style="color: #643691;">Spring</span> 회원 가입
				</h4>
				<button type="button" class="close" data-dismiss="modal">×</button>

			</div>

			<div class="modal-body">

				
					<table
						style="cellpadding: 0; cellspacing: 0; margin: 0 auto; width: 100%">
						<tr>
							<td style="text-align: left">
								<p><strong>아이디를 입력해주세요.</strong>&nbsp;&nbsp;&nbsp;<span id="idChk"></span></p>
							</td>
								
							
						</tr>
						<tr>
							<td><input type="text" name="userId" id="user_id"
								class="form-control tooltipstered" maxlength="14"
								required="required" aria-required="true"
								style="margin-bottom: 25px; width: 100%; height: 40px; border: 1px solid #d9d9de"
								placeholder="숫자와 영어로 4-10자">
								</td>
							
						</tr>

						<tr>
							<td style="text-align: left">
								<p><strong>비밀번호를 입력해주세요.</strong>&nbsp;&nbsp;&nbsp;<span id="pwChk"></span></p>
							</td>
						</tr>
						<tr>
							<td><input type="password" size="17" maxlength="20" id="password"
								name="userPw" class="form-control tooltipstered" 
								maxlength="20" required="required" aria-required="true"
								style="ime-mode: inactive; margin-bottom: 25px; height: 40px; border: 1px solid #d9d9de"
								placeholder="영문과 특수문자를 포함한 최소 8자"></td>
						</tr>
						<tr>
							<td style="text-align: left">
								<p><strong>비밀번호를 재확인해주세요.</strong>&nbsp;&nbsp;&nbsp;<span id="pwChk2"></span></p>
							</td>
						</tr>
						<tr>
							<td><input type="password" size="17" maxlength="20" id="password_check"
								name="pw_check" class="form-control tooltipstered" 
								maxlength="20" required="required" aria-required="true"
								style="ime-mode: inactive; margin-bottom: 25px; height: 40px; border: 1px solid #d9d9de"
								placeholder="비밀번호가 일치해야합니다."></td>
						</tr>

						<tr>
							<td style="text-align: left">
								<p><strong>이름을 입력해주세요.</strong>&nbsp;&nbsp;&nbsp;<span id="nameChk"></span></p>
							</td>
						</tr>
						<tr>
							<td><input type="text" name="userName" id="user_name"
								class="form-control tooltipstered" maxlength="6"
								required="required" aria-required="true"
								style="margin-bottom: 25px; width: 100%; height: 40px; border: 1px solid #d9d9de"
								placeholder="한글로 최대 6자"></td>
						</tr>

						<tr>
							<td style="padding-top: 10px; text-align: center">
								<p><strong>회원가입을 환영합니다~~!</strong></p>
							</td>
						</tr>
						<tr>
							<td style="width: 100%; text-align: center; colspan: 2;"><input
								type="button" value="회원가입" 
								class="btn form-control tooltipstered" id="signup-btn"
								style="background-color: #643691; margin-top: 0; height: 40px; color: white; border: 0px solid #388E3C; opacity: 0.8">
							</td>
						</tr>

					</table>
			
			</div>
		</div>
	</div>

 

 


2. 검증로직 작성(아이디 공백란)

 

$(function() {
      
      //각 입력값들의 유효성 검증을 위한 정규표현식을 변수로 선언.
         const getIdCheck = RegExp(/^[a-zA-Z0-9]{4,14}$/);
         const getPwCheck = RegExp(/([a-zA-Z0-9].*[!,@,#,$,%,^,&,*,?,_,~])|([!,@,#,$,%,^,&,*,?,_,~].*[a-zA-Z0-9])/);
         const getNameCheck = RegExp(/^[가-힣]+$/);
         
      // 입력값 중 하나라도 만족하지 못한다면 회원가입 처리를 막기위한 논리형 변수 선언.
     	 let chk1 = false, chk2 = false, chk3 = false, chk4 = false;
     	    
      //회원가입시 사용자의 입력값 검증!
      
      //1. ID입력값 검증 
      $('#user_id').keyup(function() {
         if($(this).val() === '' ) {//지금 발생하는 이곳이 빈 문자열이니?
            $(this).css('background-color', 'pink');
            $('#idChk').html('<b style="font-size: 14px; color: red">[아이디는 필수값입니다.]</b>');//텍스트를 집어넣을거야 
            chk1 = false;
         }

 

나중에 입력값 유효성 검사 진행  let chk1 = false, chk2 = false, chk3 = false, chk4 = false;
if 각 부분에 chk1 = false 등 
if로 && 앤드기호로 다 트루값이 왔는지 확인 후 이벤트 종료

 


3. DB와 연동하여 비동기 통신으로 아이디 중복값 확인

 

 

//아이디 입력값 유효성 검사(영문으로만 4~14글자 허용)
         //정규표현식변수.test('검증하고 싶은 값')  => return boolean type
         //정규표현식에 어긋난 값이면 false, 올바른 값이면true를 반환
         else if(!getIdCheck.test($(this).val())) {//정규표현식이 틀렸다면
            $(this).css('background-color', 'pink');
            $('#idChk').html('<b style="font-size: 14px; color: red">[영문자, 숫자조합 4-14로쓰세요]</b>');
            chk1 = false;
         }else{//아이디 중복확인 ajax 사용, 특정 호직이 실행이 끝날 때까지 기다리지 않고 먼저 코드를 샐행 (페이지 전환 없이 통신)
        	 
         	//ID중복 확인 통신을 위해 입력값을 가져오기
         	const id = $(this).val();
         
         	//ajax 호출.
         	//클라이언트에서 서버와 비동기 통신을 진행하는 ajax함수.
         	$.ajax({
         		 type :'post', // 서버에 전송하는 http방식
         		 url :'/user/checkId', // 서버 요청 url
         		 headers : {
         			 'Content-Type' : 'application/json'
         		 },
         		 dataType : 'text', //서버로 부터 응답받을 데이터의 형태 
        		 data : id, // 서버로 전송할 데이터 // 위에서 지정한 const id 
        		 success : function(result) { // 매개변수에 통신성공시 데이터가 저장된다.
					//서버와 통신성공시 실행할 내용 작성.
					console.log('통신 성공!' + result);
        		 	if(result === 'available'){
        		 		 $('#user_id').css('background-color', 'aqua');
        		 		 $('#idChk').html('<b style="font-size: 14px; color: green">[아이디 사용이 가능하다.]</b>');
        		 		 chk1 = true;
        		 	}else{
        		 		 $('#user_id').css('background-color', 'pink');
        		 		 $('#idChk').html('<b style="font-size: 14px; color: red">[아이디 중복!.]</b>');
        		 		 chk1 = false;
        		 	}
				},
				error : function (status, error) { //통신에 실패했을때
					console.log('통신실패');
					console.log(status, error)
				}
          	}); // end ajax(아이디 중복 확인)
         }

 

ajax의 사용법!

1.type은 get이나 post 같은 http method를 나타낸다.

2.url는 데이터를 받아올 페이지다. 이 페이지의 코드는 곧 설명하겠다.

3.data는 요청시에 함께 보낼 파라미터들이다. 난 그냥 안보낼거라 비워뒀다.

4.dataType은 받아올 데이터의 형식인데, 빼놔도 된다.

5.success는 성공시에 수행할 핸들러를 받는다.

6.error는 실패시에 수행할 핸들러를 받는다.

 


4. 컨트롤러 작성

@PostMapping("/checkId")
	public String checkId(@RequestBody String account) {	// 받을 데이터타입이 텍스트라 스트링으로함 반드시 리퀘스트바디를 붙힐것! ajax 통신시
		System.out.println("/user/checkId : post");
		System.out.println("param : " + account );
		
		int checkNum = serivce.checkId(account);
		
		if(checkNum == 1) {
			System.out.println("아이디가 중복되었다.");
			return "duplicated";
		}else {
			System.out.println("아이디 사용 가능");
			return "available";
		}
	}

@RequestBody String account의 값으로 ajax로 전달한 아이디가 account값으로 전달된다.

이때 컨트롤러에서는 UserService 객체로 전달하여 sql에 접근한다. 

이때 sql문을 count(*)을 썻으므로 1혹은 0이 값으로 오기 때문에 int로 값을 잡는다.

 


5. 서비스 작성

 

@Service
public class BoardService implements IBoardService {
	
	@Autowired
	private IBoardMapper mapper;

	@Override
	public void insert(BoardVO article) {
		mapper.insert(article);
	}

서비스에서 mapper로 값을 전달한다. 

 

즉 컨트롤러 > 서비스 > 인터페이스매퍼 > 매퍼.xml로 전달되어 SQL 쿼리문을 작동하게 된다. 

 

<select id="checkId" resultType="int">
     	select count(*) from mvc_user where account = #{account}
     	</select>

 

UserMapper.xml에서 이부분이 작동되게 된다. 

 


6. 최종 동작 확인 

 

컨트롤러에서 아이디가 중복 되었으면 duplicated 

아이디가 사용이 가능하면 available이 리턴되어 jsp파일로 가게 설정이 되어있다. 

다시 컨트롤러와 jsp를 보자

@PostMapping("/checkId")
	public String checkId(@RequestBody String account) {	// 받을 데이터타입이 텍스트라 스트링으로함 반드시 리퀘스트바디를 붙힐것! ajax 통신시
		System.out.println("/user/checkId : post");
		System.out.println("param : " + account );
		
		int checkNum = serivce.checkId(account);
		
		if(checkNum == 1) {
			System.out.println("아이디가 중복되었다.");
			return "duplicated";
		}else {
			System.out.println("아이디 사용 가능");
			return "available";
		}
	}
$.ajax({
         		 type :'post', // 서버에 전송하는 http방식
         		 url :'/user/checkId', // 서버 요청 url
         		 headers : {
         			 'Content-Type' : 'application/json'
         		 },
         		 dataType : 'text', //서버로 부터 응답받을 데이터의 형태 
        		 data : id, // 서버로 전송할 데이터 // 위에서 지정한 const id 
        		 success : function(result) { // 매개변수에 통신성공시 데이터가 저장된다.
					//서버와 통신성공시 실행할 내용 작성.
					console.log('통신 성공!' + result);
        		 	if(result === 'available'){
        		 		 $('#user_id').css('background-color', 'aqua');
        		 		 $('#idChk').html('<b style="font-size: 14px; color: green">[아이디 사용이 가능하다.]</b>');
        		 		 chk1 = true;
        		 	}else{
        		 		 $('#user_id').css('background-color', 'pink');
        		 		 $('#idChk').html('<b style="font-size: 14px; color: red">[아이디 중복!.]</b>');
        		 		 chk1 = false;
        		 	}
				},
				error : function (status, error) { //통신에 실패했을때
					console.log('통신실패');
					console.log(status, error)
				}
          	}); // end ajax(아이디 중복 확인)

 


7. 동작확인 

 

필수 값을 누락 하였을때
아이디 입력란을 공란으로 둘경우
모든 조건을 충족할 경우
아이디가 중복일 경우

반응형
반응형

학원에서 강의 겸 정리하는 회원가입 진행순서 테스트 모듈까지 

 

1. src -> resouces > web-inf - spring > mvc_config에서 

 

마이바티스 스프링 스캔 및 빈 등록을 해준다. 

 

2. 빈 등록을 마쳤으면

 

user > model > class를 만든다. userVO라는 모델클래스를 만들어 

안에 내용은 private를 사용하여 getter , setter tostring까지 생성해준다. 

 

3.

repositroy에 iUserMapper라는 인터페이스를 생성해준다. 

해당 내용은 

 

public interface IUserMapper {

//아이디 중복체크 기능
int checkId(String account);

//회원 가입기능
void register(UserVO vo);

//회원 정보 조회 기능 
UserVO selectOne(String account);

//회원 탈퇴 기능 
void delete(String account);
}

 

이정도의 추상 메소드를 작성해준다 .

 

 

4. Mapper.xml 제작

1.에서 만들었던

이형식에 맞추어 파일을 생성한다. 

 

마이바티스 xml이라는 걸 알기 위해 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
    "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> 를 상단에 붙혀 준다. 

 

mapper라는 태그를 만들어 준다 이때 namespace에 IuserMapper의 주소값을 넣어준다

필자는 . <mapper namespace="com.spring.mvc.user.repository.IUserMapper"> 이런식으로 넣었다. 

 

5. Test.class파일 제작 

 

src/test/java > 경로 > user 폴더 

 

만들어 준뒤 어노테이션으로 runwith와 contextconfiguration을 입력 주소값은 자동완성으로 완성된다

 

테스트값을 위해 아까 만들어주었던 iuserMapper 객체를 사용한다. 

 

회원가입, 중복값 체크 해당 아이디 찾기 ,아이디 삭제 기능을 테스트 값으로 입력하였댜.

테스트에 메소드는 이렇게 4개를 만들어 주고 이제 아까 만들었던 userMapper.xml에서 sql문만 완성시켜주면 

테스트는 완성이된다. 

 

6.xml파일에 sql문 입력

 

resultmap에는 uservo의 변수명과 오라클의 컬럼값이 다를때 사용한다. 

prioperty에는 uservo의 변수명을 입력하고 , column값에는 테이블의 컬럼값을 입력한다. 

 

각 태그의 id값은 IuserMapper의 메소드명과 똑같이 작성한다. 

이때 <select> 문에서 resulttype값을 int로 가져온다. 왜냐하면 count(*)함수를 입력했을때 1또는 0이 나오기 떄문이다. 

그리고 selectone에서 resultMap의 경우는 regdate의 값이 달라 resultmap을 참고한다. 

 

이렇게 sql문이 완성이 되었으면 이제 테스트를 시작해보자.

 

7. 테스트 실행

 

outline에서 해당 메소드를 클릭한뒤 runas > junit을 실행하면된다. 

 

성공시 화면

값이 정상적으로 들어왔다. 

 

실패시 화면

 

실패시 로딩바가 빨간색으로 변하며 아래 모니터 모양에 오류코드가 나오게 된다. 

 

ora-00001은 중복값이 발생하여서 그렇다. 

 

다음 포스팅에는 화면구현까지 알아보자.

반응형

+ Recent posts