반응형

@RestController 시작 전 준비과정이 궁금하다면?

https://maxtime1004.tistory.com/80

 

[JSP] @RestController 문자열 전달하기

REST의 정의가 궁금하다면? ˙ RestController 이용하여 REST 기능 구현하기 Spring Legacy Project > MVC 로 프로젝트를 생성합니다. pom.xml을 열어 스프링 버전을 4.1.1로 변경 후 저장합니다. 1 2 3 4 5 6 7..

maxtime1004.tistory.com

 

 

 

pom.xml에 해당 코드를추가합니다.

 

 

 

MemberVO

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package com.myspring.pro29.ex01;
 
public class MemberVO {
    private String id;
    private String pwd;
    private String name;
    private String email;
    
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public String getPwd() {
        return pwd;
    }
    public void setPwd(String pwd) {
        this.pwd = pwd;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getEmail() {
        return email;
    }
    public void setEmail(String email) {
        this.email = email;
    }
    
    @Override
    public String toString() {
        String info = id + ", " + pwd + ", " + name + ", " + email;
        return info;
    }
        
}
 
cs

 

 

 

TestController

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package com.myspring.pro29.ex01;
 
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
@RestController
@RequestMapping("/test/*")
public class TestController {
    @RequestMapping("/hello")
    public String hello() {
        return "Hello REST!!";
    }
    
    @RequestMapping("/member")
    public MemberVO member() {
        MemberVO vo = new MemberVO();
        vo.setId("hong");
        vo.setPwd("1234");
        vo.setName("홍길동");
        vo.setEmail("hong@test.com");
        
        return vo;
    }
}
 
cs

 

 실행결과 

 

반응형
반응형

REST의 정의가 궁금하다면?

https://maxtime1004.tistory.com/79

 

[JSP] REST 란?

˙ REST란?  Representational State Transfer의 약자로, 하나의 URI가 고유한 리소스를 처리하는 공통 방식입니다. 예를 들어 /board/112로 요청할 경우 이는 게시글 중 112번째 글을 의미합니다. 그리고 전송..

maxtime1004.tistory.com

 

 

˙ RestController 이용하여 REST 기능 구현하기 

 

Spring Legacy Project > MVC 로 프로젝트를 생성합니다.

 

 

pom.xml을 열어 스프링 버전을 4.1.1로 변경 후 저장합니다.

 

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
package com.myspring.pro29.ex01;
 
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
@RestController
@RequestMapping("/test/*")
public class TestController {
    
    @RequestMapping("/hello")
    public String hello() {
        return "Hello REST!!";
    }
}
 
cs

 

TestController.java를 생성 후 코드를 작성합니다.

 

 

서버에 등록해주고 Web Modules에서 다음과 같이 변경합니다.

 

 

해당 주소로 접근하면 다음과 같은 화면이 나타납니다.

 

 

 

˙ 전송된 데이터의 종류 알아보기  

 

 

F12 버튼을 누른 후 Network를 클릭 후 새로고침을 합니다.

Name에 hello를 클릭하고 Header를 클릭하면 Content-Type을 확인할 수 있습니다.

반응형
반응형

 

 

˙ REST란?  

 

Representational State Transfer의 약자로, 하나의 URI가 고유한 리소스를 처리하는 공통 방식입니다.

예를 들어 /board/112로 요청할 경우 이는 게시글 중 112번째 글을 의미합니다.

그리고 전송 방식을 나타내는 method 속성의 값에 따라 리소스에 대한 추가 작업을 요청합니다.

REST 방식으로 제공되는 API를 REST API (또는 RESTful API) 라고 합니다.

 

 

 

 

˙ 등장 배경   

 

모바일 기기는 네트워크 전송량이 유선 기기보다 떨어지므로 PC에서 동작하는 것과는 달리 화면은 그대로 유지하면서

필요한 데이터만 전송 받아 빠르게 결과를 표시합니다.

스프링에서도 모바일 기기와 연동하는 경우가 많아지면서 데이터만 전송하는 기능을 지원하게 되었고,

자연히 표준화의 필요성도 대두되었습니다.

그 결과 REST라는 방식이 그 대안으로 등장하여 사용 되고 있습니다.

 

 

 

 

RestController가 궁금하다면?↓↓↓↓↓

https://maxtime1004.tistory.com/80

 

[JSP] @RestController 문자열 전달하기

REST의 정의가 궁금하다면? ˙ RestController 이용하여 REST 기능 구현하기 Spring Legacy Project > MVC 로 프로젝트를 생성합니다. pom.xml을 열어 스프링 버전을 4.1.1로 변경 후 저장합니다. 1 2 3 4 5 6 7..

maxtime1004.tistory.com

반응형
반응형

이전 글 보러가기 ↓↓↓↓↓

https://maxtime1004.tistory.com/77

 

[JSP] MVC를 이용한 회원관리(추가/회원가입) - 2

이전 글 보러가기 ↓↓↓↓↓ https://maxtime1004.tistory.com/76 [JSP] MVC를 이용한 회원관리(조회) - 1 다음 글 보러가기 ↓↓↓↓↓ https://maxtime1004.tistory.com/77 <%@ taglib prefix="fmt" uri="http:..

maxtime1004.tistory.com


 

listMembers.jsp

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<%@ page language="java" contentType="text/html; charset=UTF-8"
    import=" java.util.*,sec01.ex01.*"
    pageEncoding="UTF-8"
    isELIgnored="false"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
    request.setCharacterEncoding("utf-8");
%>
<c:set var="contextPath" value="${pageContext.request.contextPath }"/>
<!DOCTYPE html>
<html>
<head>
 
<c:choose>
    <c:when test='${msg=="addMember" }'>
        <script>
            window.onload = function(){
                alert("회원을 등록했습니다.");
            }
        </script>
    </c:when>
    <c:when test='${msg=="modified" }'>
        <script>
            window.onload = function(){
                alert("회원 정보를 수정했습니다.");
            }
        </script>
    </c:when>    
    <c:when test='${msg=="deleted"}'>
        <script>
            window.onload = function(){
                alert("회원 정보를 삭제했습니다.");
            }
        </script>
    </c:when>
    
</c:choose>
<style type="text/css">
table{
    text-align: center;
    border : 2px solid gray;
}
tr{
    text-align: center;
    border : 2px solid gray;
}
tr th{
    border : 1px solid gray;
    background-color: lightgreen;
}
td{
    border : 1px solid gray;
    width: 7%;
}
.cls1{
    font-size: 40px;
    text-align: center;
}
 
</style>
<meta charset="UTF-8">
<title>회원 정보 출력창</title>
</head>
<body>
    <p class="cls1">회원정보</p>
    <table>
        <tr>
            <th><b>아이디</b></th>
            <th><b>비밀번호</b></th>
            <th><b>이름</b></th>
            <th><b>이메일</b></th>
            <th><b>가입일</b></th>
            <th><b>수정</b></th>
            <th><b>삭제</b></th>
        </tr>
        
        <c:choose>
            <c:when test="${empty membersList}">
                <tr>
                    <td colspan="5">
                        <b>등록된 회원이 없습니다.</b>
                    </td>
                </tr>
            </c:when>
            
            <c:when test="${!empty membersList}">
                <c:forEach var="mem" items="${membersList }">
                    <tr>
                        <td>${mem.id }</td>
                        <td>${mem.pwd }</td>
                        <td>${mem.name }</td>
                        <td>${mem.email }</td>
                        <td>${mem.joinDate }</td>
                        <td><a href="${contextPath}/member/modMemberForm.do?id=${mem.id}">수정</a></td>
                        <td><a href="${contextPath}/member/delMember.do?id=${mem.id}">삭제</a></td>
                    </tr>
                </c:forEach>
            </c:when>
        </c:choose>
    </table>
    <br>
    <a href="${contextPath}/member/memberForm.do">회원 가입하기</a>
</body>
</html>
cs
 
 

 

memberForm.jsp
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"
    isELIgnored="false"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="contextPath" value="${pageContext.request.contextPath }"/>
<!DOCTYPE html>
<html>
<head>
<style>
 
h1{
    text-align: center;
}
table{
    text-align: center;
}
th{
    width: 200px;
}
td{
    width: 400px;
}
 
</style>
<meta charset="UTF-8">
<title>회원가입창</title>
</head>
<body>
<form method="post" action="${contextPath}/member/addMember.do">
    <h1>회원가입창</h1>
    <table>
        <tr>
            <th>
                <p align="right">아이디</p>
            </th>
            <td><input type="text" name="id"></td>
        </tr>
        
        <tr>
            <th>
                <p align="right">비밀번호</p>
            </th>
            <td><input type="password" name="pwd"></td>
        </tr>
        
        <tr>
            <th>
                <p align="right">이름</p>
            </th>
            <td><input type="text" name="name"></td>
        </tr>
        <tr>
            <th>
                <p align="right">이메일</p>
            </th>
            <td><input type="text" name="email"></td>
        </tr>
        <tr>
            <th>
                <p align="right">&nbsp;</p>
            </th>
            <td>
            <input type="submit" value="가입하기">
            <input type="reset" value="다시입력">
            </td>
        </tr>
    </table>
</form>
</body>
</html>
cs
 
 
 

modMemberForm.jsp

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"
    isELIgnored="false"
    %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="contextPath" value="${pageContext.request.contextPath }"/>
<%
request.setCharacterEncoding("utf-8");
 
%>
<!DOCTYPE html>
<html>
<head>
<style>
h1{
    text-align: center;
}
table{
    text-align: center;
}
th{
    width: 200px;
}
td{
    width: 400px;
}
.cls1{
    font-size: 40px;
    text-align: center;
}
 
</style>
<meta charset="UTF-8">
<title>회원정보 수정창</title>
</head>
<body>
    <h1 class="cls1">회원 정보 수정창</h1>
    <form method="post" action="${contextPath}/member/modMember.do?id=${memInfo.id}">
        <table>
            <tr>
                <th>
                    <p align="right">아이디</p>
                </th>
                <td><input type="text" name="id" value="${memInfo.id}" disabled></td>
            </tr>
            
            <tr>
                <th>
                    <p align="right">비밀번호</p>
                </th>
                <td><input type="password" name="pwd" value="${memInfo.pwd}" value="${memInfo.pwd }"></td>
            </tr>
            
            <tr>
                <th>
                    <p align="right">이름</p>
                </th>
                <td><input type="text" name="name" value="${memInfo.name}"></td>
            </tr>
            
            <tr>
                <th>
                    <p align="right">이메일</p>
                </th>
                <td><input type="text" name="email" value="${memInfo.email}"></td>
            </tr>
            
            <tr>
                <th>
                    <p align="right">가입일</p>
                </th>
                <td><input type="text" name="joinDate" value="${memInfo.joinDate}" disabled></td>
            </tr>
            
            <tr align="center">
                <td></td>
                <td><input type="submit" value="수정하기"></td>
            </tr>
 
            <tr align="center">
            <td></td>
            <td ><input type="reset" value="다시입력"></td>
            </tr>
        </table>
    
    </form>
 
</body>
</html>
cs

 

 

 

MemberVO.java

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package sec01.ex01;
 
import java.util.Date;
 
public class MemberVO {
    private String id;
    private String pwd;
    private String name;
    private String email;
    private Date joinDate;
    
    
    public MemberVO(String id, String pwd, String name, String email) {
        this.id = id;
        this.pwd = pwd;
        this.name = name;
        this.email = email;
    }
    
    public MemberVO(String id, String pwd, String name, String email, Date joinDate) {
        this.id = id;
        this.pwd = pwd;
        this.name = name;
        this.email = email;
        this.joinDate = joinDate;
    }
 
    public String getId() {
        return id;
    }
 
    public void setId(String id) {
        this.id = id;
    }
 
    public String getPwd() {
        return pwd;
    }
 
    public void setPwd(String pwd) {
        this.pwd = pwd;
    }
 
    public String getName() {
        return name;
    }
 
    public void setName(String name) {
        this.name = name;
    }
 
    public String getEmail() {
        return email;
    }
 
    public void setEmail(String email) {
        this.email = email;
    }
 
    public Date getJoinDate() {
        return joinDate;
    }
 
    public void setJoinDate(Date joinDate) {
        this.joinDate = joinDate;
    }    
 
}
 
 
cs

 

 

 

MemberDAO

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
package sec01.ex01;
 
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
 
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.sql.DataSource;
 
public class MemberDAO {
    private DataSource dataFactory;
    private Connection conn;
    private PreparedStatement pstmt;
    
    public MemberDAO() {
        try {
            Context ctx = new InitialContext();
            Context envContext = (Context) ctx.lookup("java:/comp/env");
            dataFactory = (DataSource) envContext.lookup("jdbc/oracle");
        }catch(Exception e) {
            e.printStackTrace();
        }
    }
    
    public List<MemberVO> listMembers(){
        List<MemberVO> membersList = new ArrayList<MemberVO>();
        try {
            conn = dataFactory.getConnection();
            String query = "select * from t_member order by joinDate desc";
            System.out.println(query);
            pstmt = conn.prepareStatement(query);
            ResultSet rs = pstmt.executeQuery();
            while(rs.next()) {
                String id = rs.getString("id");
                String pwd = rs.getString("pwd");
                String name = rs.getString("name");
                String email = rs.getString("email");
                Date joinDate = rs.getDate("joinDate");
                
                MemberVO memberVO = new MemberVO(id, pwd, name, email, joinDate);
                membersList.add(memberVO);
            }
            rs.close();
            pstmt.close();
            conn.close();
        }catch (SQLException e) {
            e.printStackTrace();
        }
        return membersList;
    }
 
    public void addMember(MemberVO m) {
 
        try {
            conn = dataFactory.getConnection();
            String id = m.getId();
            String pwd = m.getPwd();
            String name = m.getName();
            String email = m.getEmail();
            String query = "insert into t_member(id, pwd, name, email)"
                            + " values(?, ?, ?, ?)";
            System.out.println(query);
            pstmt = conn.prepareStatement(query);
            pstmt.setString(1, id);
            pstmt.setString(2, pwd);
            pstmt.setString(3, name);
            pstmt.setString(4, email);
            pstmt.executeUpdate();
            pstmt.close();
            conn.close();
        }catch (SQLException e) {
            e.printStackTrace();
        }
    }
 
    public MemberVO findMember(String _id) {
        MemberVO memInfo = null;
        try {
            conn = dataFactory.getConnection();
            String query = "select * from t_member where id=?";
            pstmt = conn.prepareStatement(query);
            pstmt.setString(1, _id);
            System.out.println(query);
            ResultSet rs = pstmt.executeQuery();
            rs.next();
            String id = rs.getString("id");
            String pwd = rs.getString("pwd");
            String name = rs.getString("name");
            String email = rs.getString("email");
            Date joinDate = rs.getDate("joinDate");
            memInfo = new MemberVO(id, pwd, name, email, joinDate);
            pstmt.close();
            conn.close();
        }catch (Exception e) {
            e.printStackTrace();
        }
        return memInfo;
    }
    
    public void modMember(MemberVO memberVO) {
        String id = memberVO.getId();
        String pwd = memberVO.getPwd();
        String name = memberVO.getName();
        String email = memberVO.getEmail();
        try {
            conn = dataFactory.getConnection();
            String query = "update t_member" +
                            " set pwd=?, name=?, email=?" + 
                            " where id=?";
            
            System.out.println(query);
            pstmt = conn.prepareStatement(query);
            pstmt.setString(1, pwd);
            pstmt.setString(2, name);
            pstmt.setString(3, email);
            pstmt.setString(4, id);
            pstmt.executeUpdate();
            pstmt.close();
            conn.close();
        }catch (Exception e) {
            e.printStackTrace();
        }
    }
    
    public void delMember(String id) {
        try {
            conn = dataFactory.getConnection();
            String query = "delete from t_member" + 
                            " where id=?";
            pstmt = conn.prepareStatement(query);
            pstmt.setString(1, id);
            pstmt.executeUpdate();
        }catch(Exception e) {
            e.printStackTrace();
        }
    }
}
 
cs

 

 

 

MemberController

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
package sec01.ex01;
 
import java.io.IOException;
 
import javax.servlet.RequestDispatcher;
import java.util.List;
 
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
 
/**
 * Servlet implementation class MemberController
 */
@WebServlet("/member/*"//   /mem.do -> /member/* 
public class MemberController extends HttpServlet {
    private static final long serialVersionUID = 1L;
    MemberDAO memberDAO;
    /**
     * @see Servlet#init(ServletConfig)
     */
    public void init(ServletConfig config) throws ServletException {
        memberDAO = new MemberDAO();
    }
 
    /**
     * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
     */
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doHandle(request,response);
    }
 
    /**
     * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
     */
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doHandle(request,response);
    }
    
    //변경
    private void doHandle(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{
        String nextPage = null//변경
        request.setCharacterEncoding("utf-8");
        response.setContentType("text/html;charset=utf-8");
        String action = request.getPathInfo();
        System.out.println("action : " + action);
        
        if(action == null || action.equals("/listMembers.do")) {
            List<MemberVO> membersList =  memberDAO.listMembers();
            request.setAttribute("membersList", membersList);
            nextPage = "/test03/listMembers.jsp";
        }else if(action.equals("/addMember.do")) {
            String id = request.getParameter("id");
            String pwd = request.getParameter("pwd");
            String name = request.getParameter("name");
            String email = request.getParameter("email");
            MemberVO memberVO = new MemberVO(id,pwd,name,email);
            memberDAO.addMember(memberVO);
            nextPage="/member/listMembers.do";
        }else if(action.equals("/memberForm.do")) {
            String id = request.getParameter("id");
            MemberVO memInfo = memberDAO.findMember(id);
            request.setAttribute("memInfo", memInfo);
            nextPage = "/test03/memberForm.jsp";
        }else if(action.equals("/modMemberForm.do")){
            String id = request.getParameter("id");
            MemberVO memInfo = memberDAO.findMember(id);
            request.setAttribute("memInfo", memInfo);
            nextPage = "/test03/modMemberForm.jsp";
        }else if(action.equals("/modMember.do")){
            String id = request.getParameter("id");
            String pwd = request.getParameter("pwd");
            String name = request.getParameter("name");
            String email = request.getParameter("email");
            MemberVO memberVO = new MemberVO(id, pwd, name, email);
            memberDAO.modMember(memberVO);
            request.setAttribute("msg""modified");
            nextPage = "/member/listMembers.do";
        }else if(action.equals("/delMember.do")){
            String id = request.getParameter("id");
            memberDAO.delMember(id);
            request.setAttribute("msg""deleted");
            nextPage = "/member/listMembers.do";
        }else {
            List<MemberVO> membersList = memberDAO.listMembers();
            request.setAttribute("membersList", membersList);
            nextPage = "/test03/listMembers.jsp";
        }
        RequestDispatcher dispatch = request.getRequestDispatcher(nextPage);
        dispatch.forward(request, response);
        
    }
 
}
 
cs

 

 

 

실행화면

회원 목록 페이지로 이동해 수정 버튼을 클릭합니다.

 

회원 정보를 수정한 뒤 수정하기 버튼을 클릭합니다.

 

정보가 수정된 것을 확인할 수 있습니다. 이번엔 삭제 버튼을 클릭합니다.

 

회원 정보를 삭제했다는 알림창이 뜨면 확인을 클릭합니다.

 

목록에서 해당 정보가 삭제된 것을 확인할 수 있습니다.

반응형
반응형

 

이전 글 보러가기 ↓↓↓↓↓

https://maxtime1004.tistory.com/76

 

[JSP] MVC를 이용한 회원관리(조회) - 1

다음 글 보러가기 ↓↓↓↓↓ https://maxtime1004.tistory.com/77 <%@ taglib prefix="fmt" uri="http://jav.." data-og-host="maxtime1004.tistory.com" data-og-source-url="https://maxtime1004.tistory.com/7..

maxtime1004.tistory.com

 

다음 글 보러가기 ↓↓↓↓↓

https://maxtime1004.tistory.com/78

 

[JSP] MVC를 이용한 회원관리(수정/삭제) - 3

이전 글 보러가기 ↓↓↓↓↓ https://maxtime1004.tistory.com/77 [JSP] MVC를 이용한 회원관리(추가/회원가입) - 2 이전 글 보러가기 ↓↓↓↓↓ https://maxtime1004.tistory.com/76 [JSP] MVC를 이용한 회원..

maxtime1004.tistory.com


 

listMembers.jsp

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<%@ page language="java" contentType="text/html; charset=UTF-8"
    import=" java.util.*,sec01.ex01.*"
    pageEncoding="UTF-8"
    isELIgnored="false"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
    request.setCharacterEncoding("utf-8");
%>
<c:set var="contextPath" value="${pageContext.request.contextPath }"/>
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
table{
    text-align: center;
    border : 2px solid gray;
}
tr{
    text-align: center;
    border : 2px solid gray;
}
tr th{
    border : 1px solid gray;
    background-color: lightgreen;
}
td{
    border : 1px solid gray;
    width: 7%;
}
.cls1{
    font-size: 40px;
    text-align: center;
}
 
</style>
<meta charset="UTF-8">
<title>회원 정보 출력창</title>
</head>
<body>
    <p class="cls1">회원정보</p>
    <table>
        <tr>
            <th><b>아이디</b></th>
            <th><b>비밀번호</b></th>
            <th><b>이름</b></th>
            <th><b>이메일</b></th>
            <th><b>가입일</b></th>
        </tr>
        
        <c:choose>
            <c:when test="${empty membersList}">
                <tr>
                    <td colspan="5">
                        <b>등록된 회원이 없습니다.</b>
                    </td>
                </tr>
            </c:when>
            
            <c:when test="${!empty membersList}">
                <c:forEach var="mem" items="${membersList }">
                    <tr>
                        <td>${mem.id }</td>
                        <td>${mem.pwd }</td>
                        <td>${mem.name }</td>
                        <td>${mem.email }</td>
                        <td>${mem.joinDate }</td>
                    </tr>
                </c:forEach>
            </c:when>
        </c:choose>
    </table>
    <br>
    <a href="${contextPath}/member/memberForm.do">회원 가입하기</a>
</body>
</html>
cs

 

 

memberForm.jsp

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"
    isELIgnored="false"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="contextPath" value="${pageContext.request.contextPath }"/>
<!DOCTYPE html>
<html>
<head>
<style>
h1{
    text-align: center;
}
table{
    text-align: center;
}
th{
    width: 200px;
}
td{
    width: 400px;
}
</style>
<meta charset="UTF-8">
<title>회원가입창</title>
</head>
<body>
<form method="post" action="${contextPath}/member/addMember.do">
    <h1>회원가입창</h1>
    <table>
        <tr>
            <th>
                <p align="right">아이디</p>
            </th>
            <td><input type="text" name="id"></td>
        </tr>
        
        <tr>
            <th>
                <p align="right">비밀번호</p>
            </th>
            <td><input type="password" name="pwd"></td>
        </tr>
        
        <tr>
            <th>
                <p align="right">이름</p>
            </th>
            <td><input type="text" name="name"></td>
        </tr>
        <tr>
            <th>
                <p align="right">이메일</p>
            </th>
            <td><input type="text" name="email"></td>
        </tr>
        <tr>
            <th>
                <p align="right">&nbsp;</p>
            </th>
            <td>
            <input type="submit" value="가입하기">
            <input type="reset" value="다시입력">
            </td>
        </tr>
    </table>
</form>
</body>
</html>
cs

 

 

MemberVO

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package sec01.ex01;
 
import java.util.Date;
 
public class MemberVO {
    private String id;
    private String pwd;
    private String name;
    private String email;
    private Date joinDate;
    
    
    public MemberVO(String id, String pwd, String name, String email) {
        this.id = id;
        this.pwd = pwd;
        this.name = name;
        this.email = email;
    }
    
    public MemberVO(String id, String pwd, String name, String email, Date joinDate) {
        this.id = id;
        this.pwd = pwd;
        this.name = name;
        this.email = email;
        this.joinDate = joinDate;
    }
 
    public String getId() {
        return id;
    }
 
    public void setId(String id) {
        this.id = id;
    }
 
    public String getPwd() {
        return pwd;
    }
 
    public void setPwd(String pwd) {
        this.pwd = pwd;
    }
 
    public String getName() {
        return name;
    }
 
    public void setName(String name) {
        this.name = name;
    }
 
    public String getEmail() {
        return email;
    }
 
    public void setEmail(String email) {
        this.email = email;
    }
 
    public Date getJoinDate() {
        return joinDate;
    }
 
    public void setJoinDate(Date joinDate) {
        this.joinDate = joinDate;
    }
 
}
 
 
cs

 

 

MemberDAO

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
package sec01.ex01;
 
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
 
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.sql.DataSource;
 
public class MemberDAO {
    private DataSource dataFactory;
    private Connection conn;
    private PreparedStatement pstmt;
    
    public MemberDAO() {
        try {
            Context ctx = new InitialContext();
            Context envContext = (Context) ctx.lookup("java:/comp/env");
            dataFactory = (DataSource) envContext.lookup("jdbc/oracle");
        }catch(Exception e) {
            e.printStackTrace();
        }
    }
    
    public List<MemberVO> listMembers(){
        List<MemberVO> membersList = new ArrayList<MemberVO>();
        try {
            conn = dataFactory.getConnection();
            String query = "select * from t_member order by joinDate desc";
            System.out.println(query);
            pstmt = conn.prepareStatement(query);
            ResultSet rs = pstmt.executeQuery();
            while(rs.next()) {
                String id = rs.getString("id");
                System.out.println(id);
                String pwd = rs.getString("pwd");
                String name = rs.getString("name");
                String email = rs.getString("email");
                Date joinDate = rs.getDate("joinDate");
                
                MemberVO memberVO = new MemberVO(id, pwd, name, email, joinDate);
                membersList.add(memberVO);
            }
            rs.close();
            pstmt.close();
            conn.close();
        }catch (SQLException e) {
            e.printStackTrace();
        }
        return membersList;
    }
 
    public void addMember(MemberVO m) {
 
        try {
            conn = dataFactory.getConnection();
            String id = m.getId();
            String pwd = m.getPwd();
            String name = m.getName();
            String email = m.getEmail();
            String query = "insert into t_member(id, pwd, name, email)"
                            + " values(?, ?, ?, ?)";
            System.out.println(query);
            pstmt = conn.prepareStatement(query);
            pstmt.setString(1, id);
            pstmt.setString(2, pwd);
            pstmt.setString(3, name);
            pstmt.setString(4, email);
            pstmt.executeUpdate();
            pstmt.close();
            conn.close();
        }catch (SQLException e) {
            e.printStackTrace();
        }
    }
}
 
cs

 

 

MemberController

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
package sec01.ex01;
 
import java.io.IOException;
 
import javax.servlet.RequestDispatcher;
import java.util.List;
 
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
 
/**
 * Servlet implementation class MemberController
 */
@WebServlet("/member/*"//   /mem.do -> /member/* 
public class MemberController extends HttpServlet {
    private static final long serialVersionUID = 1L;
    MemberDAO memberDAO;
    /**
     * @see Servlet#init(ServletConfig)
     */
    public void init(ServletConfig config) throws ServletException {
        memberDAO = new MemberDAO();
    }
 
    /**
     * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
     */
    protected void doGet(HttpServletRequest request, HttpServletResponse response) 
        throws ServletException, IOException {
        doHandle(request,response);
    }
 
    /**
     * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
     */
    protected void doPost(HttpServletRequest request, HttpServletResponse response) 
        throws ServletException, IOException {
        doHandle(request,response);
    }
    
    //변경
    private void doHandle(HttpServletRequest request, HttpServletResponse response) 
        throws ServletException, IOException{
        String nextPage = null//변경
        request.setCharacterEncoding("utf-8");
        response.setContentType("text/html;charset=utf-8");
        String action = request.getPathInfo();
        System.out.println("action : " + action);
        
        if(action == null || action.equals("/listMembers.do")) {
            List<MemberVO> membersList =  memberDAO.listMembers();
            request.setAttribute("membersList", membersList);
            nextPage = "/test02/listMembers.jsp";
        }else if(action.equals("/addMember.do")) {
            String id = request.getParameter("id");
            String pwd = request.getParameter("pwd");
            String name = request.getParameter("name");
            String email = request.getParameter("email");
            MemberVO memberVO = new MemberVO(id,pwd,name,email);
            memberDAO.addMember(memberVO);
            nextPage="/member/listMembers.do";
        }else if(action.equals("/memberForm.do")) {
            System.out.println("여기");
            nextPage = "/test02/memberForm.jsp";
        }else {
            List<MemberVO> membersList = memberDAO.listMembers();
            request.setAttribute("membersList", membersList);
            nextPage = "/test02/listMembers.jsp";
        }
        RequestDispatcher dispatch = request.getRequestDispatcher(nextPage);
        dispatch.forward(request, response);
        
    }
 
}
 
cs

 

 

실행화면

회원 정보 테이블이 나타난다. 회원 가입하기를 클릭한다.

 

 

회원 정보를 입력하고 가입하기 버튼을 클릭하면 다시 이전 화면으로 돌아와 회원 테이블을 보여준다.

 

 

 

반응형
반응형

다음 글 보러가기 ↓↓↓↓↓

https://maxtime1004.tistory.com/77

 

[JSP] MVC를 이용한 회원관리(추가/회원가입) - 2

이전 글 보러가기 ↓↓↓↓↓ https://maxtime1004.tistory.com/76 [JSP] MVC를 이용한 회원관리(조회) - 1 다음 글 보러가기 ↓↓↓↓↓ https://maxtime1004.tistory.com/77 <%@ taglib prefix="fmt" uri="http:..

maxtime1004.tistory.com


 

 

라이브러리에 jstl jar 파일을 추가합니다. 아래의 링크를 통해 다운받을 수 있습니다.

http://tomcat.apache.org/taglibs/standard/

 

Apache Taglibs - Apache Standard Taglib: JSP[tm] Standard Tag Library (JSTL) implementations

ojdbc jar파일을 추가합니다. 아래의 링크를 통해 다운받을 수 있습니다.

https://www.oracle.com/database/technologies/appdev/jdbc-downloads.html

 

tomcat dbcp 파일을 넣고 Server > context.xml 과 Webcontent > web.xml을 수정합니다.

아래의 링크를 통해 방법을 확인할 수 있습니다.

https://maxtime1004.tistory.com/57

 

[JSP] 커넥션풀(Connection Pool) 데이터베이스 연동하기

▶ 커넥션풀(ConnectionPool) 기존 데이터베이스 연동 방법은 애플리케이션에서 데이터베이스에 연결하는 과정에서 시간이 많이 걸리는데, 이 문제를 해결하기 위해 나온 방법이 커넥션풀(ConnectionPo

maxtime1004.tistory.com

 

 

MemberVO.java

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package sec01.ex01;
 
import java.util.Date;
 
public class MemberVO {
    private String id;
    private String pwd;
    private String name;
    private String email;
    private Date joinDate;
    
    
    public MemberVO(String id, String pwd, String name, String email) {
        this.id = id;
        this.pwd = pwd;
        this.name = name;
        this.email = email;
    }
    
    public MemberVO(String id, String pwd, String name, String email, Date joinDate) {
        this.id = id;
        this.pwd = pwd;
        this.name = name;
        this.email = email;
        this.joinDate = joinDate;
    }
 
    public String getId() {
        return id;
    }
 
    public void setId(String id) {
        this.id = id;
    }
 
    public String getPwd() {
        return pwd;
    }
 
    public void setPwd(String pwd) {
        this.pwd = pwd;
    }
 
    public String getName() {
        return name;
    }
 
    public void setName(String name) {
        this.name = name;
    }
 
    public String getEmail() {
        return email;
    }
 
    public void setEmail(String email) {
        this.email = email;
    }
 
    public Date getJoinDate() {
        return joinDate;
    }
 
    public void setJoinDate(Date joinDate) {
        this.joinDate = joinDate;
    }
 
}
 
 
cs

 

 

MemberDAO.java

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package sec01.ex01;
 
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
 
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.sql.DataSource;
 
public class MemberDAO {
    private DataSource dataFactory;
    private Connection conn;
    private PreparedStatement pstmt;
    
    public MemberDAO() {
        try {
            Context ctx = new InitialContext();
            Context envContext = (Context) ctx.lookup("java:/comp/env");
            dataFactory = (DataSource) envContext.lookup("jdbc/oracle");
        }catch(Exception e) {
            e.printStackTrace();
        }
    }
    
    public List<MemberVO> listMembers(){
        List<MemberVO> membersList = new ArrayList<MemberVO>();
        try {
            conn = dataFactory.getConnection();
            String query = "select * from t_member order by joinDate desc";
            System.out.println(query);
            pstmt = conn.prepareStatement(query);
            ResultSet rs = pstmt.executeQuery();
            while(rs.next()) {
                String id = rs.getString("id");
                System.out.println(id);
                String pwd = rs.getString("pwd");
                String name = rs.getString("name");
                String email = rs.getString("email");
                Date joinDate = rs.getDate("joinDate");
                
                MemberVO memberVO = new MemberVO(id, pwd, name, email, joinDate);
                membersList.add(memberVO);
            }
            rs.close();
            pstmt.close();
            conn.close();
        }catch (SQLException e) {
            e.printStackTrace();
        }
        return membersList;
    }
}
 
cs

 

 

MemberConteroller.java

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package sec01.ex01;
 
import java.io.IOException;
 
import javax.servlet.RequestDispatcher;
import java.util.List;
 
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
 
/**
 * Servlet implementation class MemberController
 */
@WebServlet("/mem.do")
public class MemberController extends HttpServlet {
    private static final long serialVersionUID = 1L;
    MemberDAO memberDAO;
    /**
     * @see Servlet#init(ServletConfig)
     */
    public void init(ServletConfig config) throws ServletException {
        memberDAO = new MemberDAO();
    }
 
    /**
     * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
     */
    protected void doGet(HttpServletRequest request, HttpServletResponse response) 
        throws ServletException, IOException {
        doHandle(request,response);
    }
 
    /**
     * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
     */
    protected void doPost(HttpServletRequest request, HttpServletResponse response) 
        throws ServletException, IOException {
        doHandle(request,response);
    }
    
    private void doHandle(HttpServletRequest request, HttpServletResponse response) 
        throws ServletException, IOException{
        request.setCharacterEncoding("utf-8");
        response.setContentType("text/html;charset=utf-8");
        List<MemberVO> membersList =  memberDAO.listMembers();
        request.setAttribute("membersList", membersList);
        
        RequestDispatcher dispatch = request.getRequestDispatcher("/test01/listMembers.jsp");
        dispatch.forward(request, response);
    }
 
}
 
cs

 

 

실행결과

 

반응형
반응형

˙ 여러가지 문자열 함수 종류

 

함수 반환 설명
fn:contains(A,B) boolean 문자열 A에 문자열 B가 포함되어 있는지 확인
fn:endWith(A,B) boolean 문자열 A의 끝이 B로 끝나는지 확인
fn:indexOf(A,B) int 문자열 A에서 B가 처음으로 위치하는 인덱스(index)를 반환
fn:length(A) int 문자열 A의 전체 길이를 반환
fn:replace(A, B, C) String 문자열 A에서 B까지 해당되는 문자를 찾아 C로 변환
fn:toLowerCase(A) String A를 모두 소문자로 변환
fn:toUpperCase(A) String A를 모두 대문자로 변환
fn:substring(A, B, C) String A에서 인덱스 번호 B에서 C까지 해당하는 문자열을 반환
fn:split(A, B) String[ ] A에서 B에서 지정한 문자열로 나누어 배열로 반환
fn:trim(A) String 문자열 A에서 앞뒤 공백을 제거

 

 

 

˙ JSTL 문자열 예제

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"
    isELIgnored="false"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%
    request.setCharacterEncoding("utf-8");
%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>문자열 함수</title>
</head>
<body>
    <c:set var="title1" value="Hello Word!!!" />
    <c:set var="title2" value="안녕하세요 JSP 입니다!!!!" />
    <c:set var="str1" value="JSP" />
    <h2> 여러가지 문자열 함수 기능 </h2>
    title1 = "Hello Word!!!"<br>
    title2 = "안녕하세요 JSP 입니다!!!!"<br>
    str1 = "JSP"<br><bR>
    
    fn:length(title1) = ${fn:length(title1) }<br>
    fn:toUpperCase(title1) = ${fn:toUpperCase(title1) }<br>
    fn:toLowerCase(title1) = ${fn:toLowerCase(title1) }<br>
    
    fn:substring(title1,3,6) = ${fn:substring(title1,3,6) }<br>
    fn:trim(title1) = ${fn:trim(title1) }<br>
    fn:replace(title1, " ", "/") = ${fn:replace(title1, " ", "/")} <br>
    
    fn:indexOf(title2, str1) = ${fn:indexOf(title2,str1) }<br>
    fn:contains(title1, str1) = ${fn:contains(title1,str1) }<br>
    fn:contains(title2, str1) = ${fn:contains(title2, str2) }<br>
 
</body>
</html>
cs

 

반응형
반응형
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<%@ page language="java" contentType="text/html; charset=UTF-8"
    import="java.util.Date" 
    pageEncoding="UTF-8"
    isELIgnored="false" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
    request.setCharacterEncoding("utf-8");
%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>포매팅 태그 라이브러리 예제</title>
</head>
<body>
    <h2>fmt의 number 태그를 이용한 숫자 포매팅 예제</h2>
    <c:set var="price" value="100000000"/>
    <fmt:formatNumber value="${price}" type="number" var="priceNumber"/>
    통화로 표현 시 :
    <fmt:formatNumber type="currency" currencySymbol="₩" value="${price}" groupingUsed="true" /><br>  
    퍼센트로 표현 시 :
    <fmt:formatNumber value="${price}" type="percent" groupingUsed="false"/><br>
    일반 숫자로 표현 시 : ${priceNumber}
    <h2>formatDate 예제</h2>
    <c:set var="now" value="<%=new Date()%>"/>
    <fmt:formatDate value="${now}" type="date" dateStyle="full" /><br>
    <fmt:formatDate value="${now}" type="date" dateStyle="short" /><br>
    <fmt:formatDate value="${now}" type="time" /><br>
    <fmt:formatDate value="${now}" type="both" dateStyle="full" timeStyle="full" /><br>
    <fmt:formatDate value="${now}" type="time" pattern="YYYY-MM-dd :hh:mm:ss" /><br><br><br>
    
    한국 현재시간 : 
    <fmt:formatDate value="${now}" type="both" dateStyle="full" timeStyle="full"/><br><br>
    <fmt:timeZone value="America/New York" >
    뉴욕 현재시간 : 
    <fmt:formatDate value="${now}" type="both" dateStyle="full" timeStyle="full" /><br>
    </fmt:timeZone>
</body> 
</html>
cs

 

 

※포매팅 태그의 종류와 의미를 알고싶다면??

https://maxtime1004.tistory.com/73

 

[JSP] 포매팅 태그 라이브러리

˙ 포매팅 태그 라이브러리 종류 분류 태그 설명 포매팅 둘 다 지정한 국가의 시간을 지정하는 태그 단, 은 태그를 열고 닫는 영역 안에서만 적용됨 표시할 숫자의 형식을 지정 지정한 형식의 날

maxtime1004.tistory.com

 

반응형

+ Recent posts