뷰페이지 작성 예

Structure of Knowledge·2021년 2월 8일
0

뷰페이지 코딩할 때, 생각해야할 문법들이 많아 예제를 올려볼 생각임.

회원가입 실패 시, 뷰페이지에서 메세지 띄움

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8" import="bit.hibooks.setting.MemberModeSet"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

	<c:if test="${!empty joinCode}">
	    <script type="text/javascript">
		var joinCode = ${joinCode}; 	//alert(joinCode);
	    	if(joinCode == <%=MemberModeSet.JOIN_F_EMAIL_EXIST%>){
	 		alert("이미 가입된 회원입니다");
		}
	    </script>
	</c:if>
  1. c태그는 jstl이고, 그 안에 script 태그는 자바스크립, ${}는 EL표현식, <%= %>는 jsp표현식태그 이다.

  2. jstl을 쓰기 위해서 jsp지시자태그 <%@ taglib %>를 써주고, 모드 상수값을 가져오기 위해, 페이지 지시자에 MemberModeSet 클래스를 임포트 해줌.

to be continued........

profile
객체와 제어, 비전공자 개발자 되기

0개의 댓글