본문 바로가기

Java

jsp에서 blob 파일 미리보기 javascript onload var img = document.getElementById('preImg'); img.src = '/labelImageView.htm?atchFileSn='; jsp java Connection conn = null; ResultSet rs = null; PreparedStatement pstmt = null; //Blob blob = null; // blob 데이터를 저장할 객체 생성 ServletOutputStream sOut = response.getOutputStream(); // 이미지를 출력할 outputStream 객체 생성 InputStream is = null; tmpDesignVO = (LabelDesignRegManage) atchList[0]; St.. 더보기
Blob 파일 다운로드 출처 : http://blog.naver.com/PostView.nhn?blogId=takmin5486&logNo=30015973420&redirect=Dlog&widgetTypeCall=true import oracle.sql.*; import oracle.jdbc.driver.*; public String searchNEvalInfoListExtListFile(String[] criteria) throws JEJBException { // JConnection conn = null; // JPreparedStatement pStmt = null; // JResultSet rs = null; Connection conn = null; PreparedStatement pStmt = null; Result.. 더보기
split 메서드 사용시 실수하기 쉬운 것 출처 : https://mytory.net/archives/285 split는 문자열을 나누는 메서드다.String 문자열 = "가:나:다:가나다"; String[] 나눈배열 = 문자열.split(":"); //나눈배열 : {"가", "나", "다", "가나다"} System.out.println(나눈배열[0]); //결과 : 가 System.out.println(나눈배열[나눈배열.length-1]); //결과 : 가나다 그런데 아래처럼 쓰면 작동을 안 한다.String 문자열 = "가.나.다.가나다"; String[] 나눈배열 = 문자열.split("."); 이렇게 써야 한다.String 문자열 = "가.나.다.가나다"; String[] 나눈배열 = 문자열.split("\\."); 그래야 작동한다. 이.. 더보기
자바 파일 폴더 생성 및 이동 package file; import java.io.File; public class FileMove { public static void main(String[] args) { FileMove fileMove = new FileMove(); String folderName = "new";//폴더 생성할 이름 String fileName = "가수이미지11.jpg"; //바뀔 이름 String beforeFilePath = "C:/tmp/upload/2015/06/25/앨범속지1.jpg"; //옮길 대상 경로 String afterFilePath = "C:/tmp/upload/"; //옮겨질 경로 String result = fileMove.moveFile(folderName, fileName, befo.. 더보기