1+1은?
2013. 7. 29. 11:46
<%@page import="java.util.Calendar"%> <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ page trimDirectiveWhitespaces="true" %> <% request.setCharacterEncoding("UTF-8"); //클라이언트에서 넘어온 정보 받기 String y=request.getParameter("year"); String m=request.getParameter("month"); //현재 컴퓨터 시스템의 날짜 구하기 Calendar cal = Calendar.getInstance(); int year = cal.get(Calendar.YEAR); int month = cal.get(Calendar.MONTH)+1; //클라이언트에서 넘겨준 값이 없을때 표시하는 값 if(y!=null) year = Integer.parseInt(y); if(m!=null) month = Integer.parseInt(m); cal.set(year, month-1, 1); year = cal.get(Calendar.YEAR); month = cal.get(Calendar.MONTH)+1; // 1일은 무슨 요일? int w = cal.get(Calendar.DAY_OF_WEEK); // 달의 마지막 날짜는? int endDays = cal.getActualMaximum(Calendar.DATE); %>Insert title here
<% int line = 0; //앞의 공백처리 out.print(""); for(int i=1; i "); line+=1; } //1~마지막날까지 출력하기 String fc; for(int i=1; i<=endDays; i++) { fc = line == 0 ? "red" : (line == 6 ? "blue" : "black"); out.print(" "); line+=1; if(line==7 && i!=endDays) { out.print(""); line = 0; } } //뒷부분 공백 처리 while(line>0 && line<7) { out.print(""); line++; } out.print(""); %>
◀ <%=year%>年<%=month%>月 ▶ 일 월 화 수 목 금 토 "); out.print(i); out.print("