InputStream in = null; OutputStream out = null; File file = null; try{ file = new File(path, newName); in = new BufferedInputStream(new FileInputStream(file)); out = new BufferedOutputStream(response.getOutputStream()); oldName = URLEncoder.encode(oldName, "UTF-8").replaceAll("\\+", " "); request.setCharacterEncoding("UTF-8"); response.setContentType("application/octet-stream"); response.setHead..
public fileUpload(@RequestParam("file")MultipartFile file){String filename = file1.getOriginalFilename(); String suffix = filename.substring(filename.lastIndexOf(".") + 1); String oldName = filename.substring(0, filename.lastIndexOf(".")); String newName = String.valueOf(System.currentTimeMillis()); File path = new File("경로"); FileOutputStream out = null; try{ byte[] fileData = paramFile.getByte..
WAS, DBMS 서버 등과 연결되는 Socket 관련 프로그램에서 다음과 같은 오류 메세지가 자주 발생한다. Connection reset by peer, Connection reset, Broken Pipe 이런 에러가 발생해도 정상적으로 잘 서비스되기 때문에 별로 관심을 안가졌는데 직접 데몬 서비를 만들고 관련 클라이언트를 만들다 보니 어떤 경우에 이런 에러가 발생하는지 알아야지만 대처가 가능할 것 같아서 찾아 보았다. - java.net.SocketException: Connection reset by peer: socket write error 원인: write 시 상대방 socket close 된 경우 - java.net.SocketException: Connection reset 원인: re..
출처 : http://blog.naver.com/PostView.nhn?blogId=napsis&logNo=140156257733&parentCategoryNo=8&viewDate=¤tPage=1&listtype=0&from=postList java.lang.IllegalStateException: getOutputStream() has already been called for this responseSTATUS : Closed Scenario : jsp to generate a report and on click of a button download the report xls from the server. Code in the jsp is as follows. response.setCont..
- String.valueOf() - 파라미터가 null 이면 문자열 null을 만들어서 담는다. - Casting((String) aa) - 대상이 null이면 당연하게 NullPointerException - 만약 Object 에 담긴 값이 String 이 아니라면 ClassCastException - "".toString() - 당연하게 . 으로 사용하는 만큼 대상 값이 null 이면 NullPointerException - Object 에 담긴 값이 String 이 아니어도 출력[출처] [Java] String : valueOf toString Casting 의 차이|작성자 고민덩어리
공부차원에서 스프링같은 프레임워크없이 게시판을 만들고있다.그 과정에서 ajax를 사용할 일이있었는데(없이 해도 되지만 써보기위해 집어넣음) jsp에서 controller까지는 요청을 보냈는데 도대체 어떻게 결과값을 다시 jsp로 가져오는지 정말 며칠을 고민했다.forward도 써보고 setAttribute도 써보고 검색도 많이 했는데 답을 못찾아서 ajax는 포기할까도 생각했지만 결국 답을 알아냈다. PrintWriter out = response.getWriter(); out.write(chkId); out.flush(); 이런식으로 그냥 서블릿상에서 값을 write해주면 ajax에서 결과값으로 사용이 가능.현재 저 코드는 chkId라는 값을 그냥 넘기는거고 json으로 처리할때는 JSONObject ..
/* 자세히 알아보진 않았는데 FTPClient 객체를 제공하는 jar가있고 FtpClient 객체를 제공하는 jar가 있는것 같다. 서로 제공하는 내용이 약간 다르니 참고하는 분들은 FTP인지 Ftp인지 잘 확인하기바람.*/ //일반파일 경로StringBuffer ftpFilePath = new StringBuffer(); //다운로드받을 파일이 있는경로 ftpFilePath.append(ConfigProperties.getProperty("download.path") + "/hub"); ftpFilePath.append("/FILE/TEXT/admbrd/" + request.getParameter("portal_cd")); FtpClient client = new FtpClient(); //FtpCl..
1. executeQuery - 쿼리 결과를 ResultSet을 얻기 위한 메소드로 주로 SELECT문에 사용됩니다. 2. executeUpdate - 쿼리문으로 데이터를 다루는 INSERT, UPDATE, DELETE문이나 테이블을 다루는 CREATE, DROP, ALTER에 사용됩니다. - 적용된 행의 갯수를 리턴합니다. 3. execute - 모든 쿼리를 다 사용할 수 있습니다.(DDL, DML, DCL) 즉, executeQuery, executeUpdate 두가지 모두의 경우를 포함합니다. - 리턴은 Boolean형으로 넘어옵니다. 출처: http://diveis.tistory.com/50
- Total
- Today
- Yesterday
- servlet
- TEST
- MySQL
- mariadb
- Git
- frontcode
- programming
- http
- db
- javascript
- Spring
- Design Pattern
- backend개발환경
- 정규표현식
- java
- OOP
- toby
- EffectiveJava
- JPA
- frontend개발환경
- clean code
- code
- Kotlin
- java8
- DesignPattern
- go-core
- generics
- JavaScript Core
- Jackson
- spring cloud
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |