var timer = setInterval(function () {

   iframe = document.getElementById('excelDown');

   var iframeDoc = iframe.contentDocument || iframe.contentWindow.document;

   // Check if loading is complete

   if (iframeDoc.readyState == 'complete' || iframeDoc.readyState == 'interactive') {

       clearInterval(timer);

       console.log(iframeDoc.readyState)

       return;

   }

}, 1);



이건 다운로드할때 자바에서 다운로드 파일 쓰고 , 다시 프로트단으로 넘어오면서 다운로드 창이 뜨는 시점을 잡기위한

'JAVA > Jquery' 카테고리의 다른 글

Jquery 입력한 날짜 월별 일수 및 날짜포맷확인  (0) 2016.11.25
Jquery 정규식 예제  (0) 2016.11.24
jquery 각종위치 함수  (0) 2016.10.21
jquery html2canvas div 다운로드  (0) 2016.10.18
Jquery 옵션체크방법  (0) 2016.10.17
블로그 이미지

왕왕왕왕

,

innerWidth() : 400 box사이즈(padding,scrollBar포함)
outerWidth() : 402 box사이즈(border,padding,scrollBar포함)
position().top : 50 parent(wrap)로 부터 위치
offset().top : 101 document로 부터 위치
height() : 250 style에 작성한 사이즈
offsetParent().offset().left : 50 parent에 접근

$(window).height(): 983 브라우저 화면사이즈
$(document).height(): 1052 문서사이즈
$(window).scrollTop() : 0 객체 스크롤 값


box2 $(this).bind 마우스좌표

clientX : 799 브라우저기준(스크롤무시)
clientY : 459 브라우저기준(스크롤무시)
pageX : 799 document기준
pageY : 459 document기준
offsetX : 799 객체기준(마우스가 지나는 객체가 변함)
offsetY : 459 객체기준(마우스가 지나는 객체가 변함)
screenX : 1049 모니터기준
screenY : 622 모니터기준
box3 $("#box3").bind 마우스좌표
offsetX : 34 객체기준
offsetY : -9 객체기준
e.pageX-$box3.offset().left:46 직접계산
e.pageY-$box3.offset().top:55 직접계산


'JAVA > Jquery' 카테고리의 다른 글

Jquery 정규식 예제  (0) 2016.11.24
jqeury iframe ready state check  (0) 2016.10.24
jquery html2canvas div 다운로드  (0) 2016.10.18
Jquery 옵션체크방법  (0) 2016.10.17
Jquery get방식 보낼때 한글깨짐 인코딩  (0) 2016.09.02
블로그 이미지

왕왕왕왕

,

자바 웹 다운로드

JAVA/자바 2016. 10. 20. 11:36

public void chartRiskStatusDownload(HttpServletRequest request , HttpServletResponse response) throws IOException, AWTException{

Map<String, Object> rtnMap = new HashMap<String, Object>();

String filename = request.getParameter("filename");

String path = request.getParameter("path");

/** HTTP 헤더 셋팅 */

// response.reset();

 

// IE 체크

response.setContentType("application/octet-stream;charset=utf-8");

response.setCharacterEncoding("UTF-8");

response.setHeader("Content-Disposition", "attachment;filename=" + filename);

response.setHeader("Content-Transfer-Encoding", "binary;");

 

/** 파일 다운로드 */

LOGGER.info(String.format(LogFormat.DEBUG,"filename "+filename+" filepath "+path));

    Robot robot = new Robot();

    

        //모니터 화면 크기 가지고 오는 객체

        Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();

 

        //모니터의 화면을 selectRect에 가로,세로 표현

        Rectangle selectRect = new Rectangle((int)screen.getWidth(), (int)screen.getHeight());

        

        //스크린샷된 데이터를 bufferedimage에 담음

        BufferedImage buffimg = robot.createScreenCapture(selectRect);

 

        

        //bufferedimage to inputstream convert

        ByteArrayOutputStream baos = new ByteArrayOutputStream();

        ImageIO.write(buffimg, "png", baos);

        InputStream is = new ByteArrayInputStream(baos.toByteArray());

        

        //output을 위해 bufferedimage를 byte데이터로 바꿈

        byte[] imageBytes = baos.toByteArray();

        

int read = 0;

BufferedInputStream fin =

new BufferedInputStream(is);

BufferedOutputStream outs =

new BufferedOutputStream(response.getOutputStream());

// 파일 읽어서 브라우저로 출력하기

try {

       while((read=fin.read(imageBytes)) != -1){

        LOGGER.info(String.format(LogFormat.DEBUG,"fileread "+read));

         outs.write(imageBytes, 0, read);

       }

} catch (Exception e) {

e.printStackTrace();

} finally{

if (outs != null) {outs.close();}

       if (fin != null) {fin.close();}

  }

}

}

블로그 이미지

왕왕왕왕

,
byte[] imageBytes = ((DataBufferByte) bufferedImage.getData().getDataBuffer()).getData();


블로그 이미지

왕왕왕왕

,

//div 아이디를 가지고 canvas로만들어줌

var element = $("#mapHolder"); // global variable

      

var getCanvas; // global variable

 

   $("#btn-Preview-Image").on('click', function () {

 

     html2canvas(element, {

        onrendered: function (canvas) {

               getCanvas = canvas;

            }

        });

       

   });



//다운로드

$("#btn-Convert-Html2Image").on('click', function () {


//익스플로러일경우

if (navigator.msSaveBlob) {

     console.log('this is IE');

     var URL=window.URL;

     var BlobBuilder = window.MSBlobBuilder;

     navigator.saveBlob=navigator.msSaveBlob;

     var imgBlob = getCanvas.msToBlob();

     if (BlobBuilder && navigator.saveBlob) {

       var showSave =  function (data, name, mimetype) {

         var builder = new BlobBuilder();

         builder.append(data);

         var blob = builder.getBlob(mimetype||"application/octet-stream");

         if (!name)

           name = "Download.bin";

         navigator.saveBlob(blob, name);

       };

       showSave(imgBlob, 'your_pic_name.png',"image/png");

     }

   } 

//크롬 또는 다른브라우저

else {

    var imgageData = getCanvas.toDataURL("image/png")

    var newData = imgageData.replace(/^data:image\/png/, "data:application/octet-stream");

     $("#btn-Convert-Html2Image").attr("download", "your_pic_name.png").attr("href", newData);

   }

});

'JAVA > Jquery' 카테고리의 다른 글

jqeury iframe ready state check  (0) 2016.10.24
jquery 각종위치 함수  (0) 2016.10.21
Jquery 옵션체크방법  (0) 2016.10.17
Jquery get방식 보낼때 한글깨짐 인코딩  (0) 2016.09.02
Jqeury jqGrid 전체 row 로직  (0) 2016.08.25
블로그 이미지

왕왕왕왕

,

$("#sgg > option[value="+parent_value.SGG+"]").attr("selected", "ture");

'JAVA > Jquery' 카테고리의 다른 글

jquery 각종위치 함수  (0) 2016.10.21
jquery html2canvas div 다운로드  (0) 2016.10.18
Jquery get방식 보낼때 한글깨짐 인코딩  (0) 2016.09.02
Jqeury jqGrid 전체 row 로직  (0) 2016.08.25
jquery oldValue newValue  (0) 2016.07.01
블로그 이미지

왕왕왕왕

,

SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMM");

Calendar cal = Calendar.getInstance();

cal.add(cal.MONTH, -1);

//기준일자 기본값 설정

model.addAttribute("searchInfo",dateFormat.format(cal.getTime()).substring(0, 6));

'JAVA > 자바' 카테고리의 다른 글

자바 웹 다운로드  (0) 2016.10.20
자바 bufferedimage to byte[] convert  (0) 2016.10.19
자바 맵 포문으로 꺼내기  (0) 2016.09.05
자바 데이터 - 스트링 변환  (0) 2016.04.26
자바 자바 jsp 호출(was) - jsp소스  (0) 2016.02.26
블로그 이미지

왕왕왕왕

,
<input type="checkbox" value="Y" ${atc.CHK_YN == "Y" ? "CHECKED" : ""}/>

'JAVA > JSP' 카테고리의 다른 글

jsp 검색조건 유지하기  (0) 2016.12.05
jsp 차단된 콘텐츠 허용 코드  (0) 2016.08.29
JSP Thumnail 처리  (0) 2015.08.25
JSP jai 라이브러리 다운 및 추가  (0) 2015.08.25
JSP Thumbnail 폼  (0) 2015.08.25
블로그 이미지

왕왕왕왕

,