728x90
반응형
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
	<p><jsp:useBean id="now" class="java.util.Date"/></p>
<%-- 	<%java.uitl.Date now = new java.util.Date();%> //현재시간에 대한 정보 --%>
	<p> date : <fmt:formatDate value="${now}" type="date"/></p>
	<p> time : <fmt:formatDate value="${now}" type="time"/></p>
	<p> both : <fmt:formatDate value="${now}" type="both"/></p><hr>
	<h3>dateStyle추가</h3>
	<p> default : <fmt:formatDate value="${now}" type="both" dateStyle="default" timeStyle="default"/></p>
	<p> short : <fmt:formatDate value="${now}" type="both" dateStyle="short" timeStyle="short"/></p>
	<p> medium : <fmt:formatDate value="${now}" type="both" dateStyle="medium" timeStyle="medium"/></p>
	<small style="color:red;"> 년월일 구분은 '.'이며, both, default, medium은 표현하는 값이 같다</small>
	<p> long : <fmt:formatDate value="${now}" type="both" dateStyle="long" timeStyle="long"/></p>
	<p> full : <fmt:formatDate value="${now}" type="both" dateStyle="full" timeStyle="full"/></p>
	<p> pattern : <fmt:formatDate value="${now}" type="both" pattern="yyyy년 MM월 dd일 HH시 mm분 ss초 E요일 D일째"/></p>
</body>
</html>

 

asf
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>08_05_02_form04_process.jsp</title>
</head>
<body>
	<%
		request.setCharacterEncoding("utf-8");
	
		String id = request.getParameter("id");
		String passwd = request.getParameter("passwd");
		String name = request.getParameter("name");
		String phone1 = request.getParameter("phone1");
		String phone2 = request.getParameter("phone2");
		String phone3 = request.getParameter("phone3");
		String gender = request.getParameter("gender");
		String[] hobby = request.getParameterValues("hobby");
		String comment = request.getParameter("comment");
	%>
	<p>아이디 : <%=id %></p>
	<p>비밀번호 : <%=passwd %></p>
	<p>이름 : <%=name %></p>
	<p>연락처 : <%=phone1 %>-<%=phone2 %>-<%=phone3 %></p>
	<p>성별 : <%=gender %></p>
	<p>취미 : 
	<%
	if (hobby != null) {
		for (int i = 0; i < hobby.length; i++) {
			out.println(" "+hobby[i]);
		}
	}else{
		out.print("선택한 취미가 없습니다.");
	}
	%>
	</p>
	<p>가입 인사 : <%=comment %></p>
</body>
</html>​

728x90
반응형

'[JAVA]' 카테고리의 다른 글

[JSTL] EL을 활용한 파라미터, 매서드 호출  (0) 2024.03.19
[JSP] form  (0) 2024.03.19
[JSP] JSTML fmt  (0) 2024.03.19
[JSP] <response.sendRedirect / sendError /setIntHeader >  (0) 2024.03.14
[JSP] URI, URL, URN  (0) 2024.03.14

+ Recent posts