JAVA (34) 썸네일형 리스트형 [JAVA] 이미지 업로드 (엑박으로 보여질때 설정) server.xml imgView(별칭)라는 아래 Context추가 controller server.xml에서 추가한 /imgView 위치를 사용 http://localhost:8080/imgView/summernote/ /** * 이미지 업로드 * @return * @exception Exception */ @PostMapping(value = "/imgUpload") public ResponseEntity imgUpload(MultipartHttpServletRequest file, HttpServletRequest request, HttpServletResponse response) throws IllegalStateException, IOException { log.debug("summernote.. [JAVA] 제네릭스(Geneics) 1. 보통 하나의 영문자로 대문자를 사용하는 것이 관례 - E : Element(자바 컬렉션에서 주로사용) - K,V : Key, Value(map 자료구조에서 주로 사용) - T : 일반적인 제네릭 타입을 의미 - N : Number를 의미 2. 와일드카드: 모든 타입을 받을 수 있는 '?' 표시 public void wildcardEx(ArrayList [JAVA] 현재날짜, 일주일전날짜, 한달전날짜 계산 날짜 산출 예제 public void dateCalcEx(int delayTime){ DecimalFormat df = new DecimalFormat("00"); Calendar currentCalendar = Calendar.getInstance(); //현재 날짜 구하기 String strYear = Integer.toString(currentCalendar.get(Calendar.YEAR)); String strMonth = df.format(currentCalendar.get(Calendar.MONTH) + 1); String strDay = df.format(currentCalendar.get(Calendar.DATE)); String strDate = strYear + strMonth + s.. [JAVA] 시간 딜레이 함수 시간 공백 필요시 사용 // 이 함수를 시 delayTime 밀리 초 후에 이 함수를 무사히 빠져나온다.. 1000 -> 1초 public void MatrixTime(int delayTime){ long saveTime = System.currentTimeMillis(); long currTime = 0; while( currTime - saveTime < delayTime){ currTime = System.currentTimeMillis(); } } [JAVA] 예외(Exception) - 로그파일 만들기 Exception 발생시 로그파일 생성 로그파일 생성 예제 import java.io.*; import java.util.*; class ExceptionEx { public static void main(String args[]) { PrintStream ps = null; FileOutputStream fos=null; try { fos = new FileOutputStream("error.log",true); // error.log파일에 출력 준비 ps=new PrintStream(fos); // err의 출력을 화면이 아닌, error.log파일로 변경 System.setErr(ps); System.out.println(1); System.out.println(2); System.out.print.. [JAVA] 파일 클래스(File Class) File class 예제 import java.io.*; public class FileEx{ public static void main(String[] args) throws IOException{ String filePath = "C:\\java_choi\\study"; File f1 = new File(filePath); String list[] = f1.list(); for(int i=0;i [JAVA] Calendar, Date, SimpleDateFormat 날짜 호출 Date 매서드에 SimpleDateFormat 매서드를 이용해 원하는 양식으로 호출 SimpleDateFormat 예제 import java.util.calendar import java.text.*; class DateFormatEx1{ public static void main(String[] args){ Date today = new Date(); SimpleDateFormat sdf1, sdf2, sdf3, sdf4; sdf1 = new SimpleDateFormat("yyyy-MM-dd"); sdf2 = new SimpleDateFormat("yy년 MMM dd일 E요일"); sdf3 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); sdf4 = new.. [JAVA] ArrayList ArrayList: 배열의 크기가 고정적이지 않아 주로 동적으로 데이터를 받아 처리할 경우 사용 ArrayList 예제 import java.util.ArrayList; public class AllTest { public static void main(String[] args) { ArrayList arrList = new ArrayList(); //: 제네릭스 arrList.add("AAA"); //0 arrList.add("BBB"); //1 arrList.add("CCC"); //2 System.out.println(arrList); //리스트 출력 System.out.println("----------"); for(int i = 0; i < arrList.size(); i++){ System.o.. 이전 1 2 3 4 5 다음 목록 더보기