<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>note</title>
    <link>https://javai.tistory.com/</link>
    <description></description>
    <language>ko</language>
    <pubDate>Wed, 15 Apr 2026 10:03:03 +0900</pubDate>
    <generator>TISTORY</generator>
    <ttl>100</ttl>
    <managingEditor>투한</managingEditor>
    <image>
      <title>note</title>
      <url>https://tistory1.daumcdn.net/tistory/887812/attach/6a584dc086cf4d8b9deec78bec46cc78</url>
      <link>https://javai.tistory.com</link>
    </image>
    <item>
      <title>Bulk upload posts to WordPress</title>
      <link>https://javai.tistory.com/700</link>
      <description>&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;You can using rest api as follow :&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;bulk/v1/post&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;bulk/v1/delete&lt;/p&gt;
&lt;pre class=&quot;php&quot;&gt;&lt;code&gt;add_action('rest_api_init', function () {
    register_rest_route('bulk/v1', '/post', array(
        'methods' =&amp;gt; 'POST',
        'callback' =&amp;gt; 'insert'
    ));
    
    register_rest_route('bulk/v1', '/delete', array(
        'methods' =&amp;gt; 'POST',
        'callback' =&amp;gt; 'delete'
    ));
});

function bulk_delete_posts($post_type = 'post', $posts_per_page = -1) {
    // 배치 크기 설정 (한 번에 처리할 게시물 수)
    $batch_size = 100;
    
    // 게시물 쿼리
    $args = array(
        'post_type'      =&amp;gt; $post_type,
        'posts_per_page' =&amp;gt; $posts_per_page,
        'post_status'    =&amp;gt; 'any',
        'fields'         =&amp;gt; 'ids',
    );

    // WP_Query 실행
    $query = new WP_Query($args);
    
    $deleteCnt = 0;

    if ($query-&amp;gt;have_posts()) {
        global $wpdb;
        $post_ids = $query-&amp;gt;posts;

        // 배치 삭제 시작
        for ($i = 0; $i &amp;lt; count($post_ids); $i += $batch_size) {
            $batch = array_slice($post_ids, $i, $batch_size);

            $wpdb-&amp;gt;query('START TRANSACTION');

            try {
                foreach ($batch as $post_id) {
                    wp_delete_post($post_id, true); // 두 번째 매개변수를 true로 설정하면 휴지통을 거치지 않고 영구 삭제함
                    $deleteCnt++;
                }
                $wpdb-&amp;gt;query('COMMIT');
            } catch (Exception $e) {
                $wpdb-&amp;gt;query('ROLLBACK');
                error_log($e-&amp;gt;getMessage());
                return $e-&amp;gt;getMessage();
            }
        }
    }
    return &quot;$deleteCnt posts deleted successfully.&quot;;
}

function delete($request) {
    $params = $request-&amp;gt;get_params();
    // 이 함수를 호출하여 게시물을 대량 삭제할 수 있음
    return bulk_delete_posts('post');
}

function insert($request) {
    $params = $request-&amp;gt;get_params();
    $file_name = $params[&quot;file_name&quot;];

    try {
        $res_str = init($file_name);
        return $res_str;
    } catch (Exception $e) {
        return $e-&amp;gt;getMessage();
    }
}

function init($file_name) {
    $csvFile = '/var/www/html/wp-content/' . $file_name;
    $batchSize = 100;
    $totalSize = 0;

    if (($handle = fopen($csvFile, 'r')) !== FALSE) {
        $header = fgetcsv($handle, 1000, ',');

        $batchData = [];
        $batchCounter = 0;

        while (($data = fgetcsv($handle, 1000, ',')) !== FALSE) {
            $batchData[] = $data;
            $batchCounter++;
            $totalSize++;

            if ($batchCounter &amp;gt;= $batchSize) {
                $batch_result = process_batch($batchData);

                if ($batch_result !== true) {
                    fclose($handle);
                    return $batch_result;
                }

                $batchData = [];
                $batchCounter = 0;
            }
        }

        if ($batchCounter &amp;gt; 0) {
            $batch_result = process_batch($batchData);

            if ($batch_result !== true) {
                fclose($handle);
                return $batch_result;
            }
        }

        fclose($handle);
    }
    return &quot;$totalSize records processed successfully.&quot;;
}

function process_batch($batchData) {
    global $wpdb;

    $wpdb-&amp;gt;query('START TRANSACTION');
    wp_defer_term_counting(true);

    foreach ($batchData as $data) {
        try {
			
            $post_title = isset($data[0]) ? $data[0] : &quot;&quot;;;
            $post_status = isset($data[1]) ? $data[1] : &quot;&quot;;;
            $post_content = isset($data[2]) ? $data[2] : &quot;&quot;;;
            $post_tag = isset($data[3]) ? explode(',', $data[3]) : &quot;&quot;;
            $post_category = isset($data[4]) ? explode(',', $data[4]) : &quot;&quot;;

            $new_post = array(
                'post_title' =&amp;gt; $post_title,
                'post_status' =&amp;gt; $post_status,
                'post_content' =&amp;gt; $post_content,
                'tags_input' =&amp;gt; $post_tag,
                'post_category' =&amp;gt; $post_category
            );

            $post_id = wp_insert_post($new_post);

            if (is_wp_error($post_id)) {
                throw new Exception($post_id-&amp;gt;get_error_message());
            }
        } catch (Exception $e) {
            $wpdb-&amp;gt;query('ROLLBACK');
            return $e-&amp;gt;getMessage();
        }
    }

    wp_defer_term_counting(false);
    $wpdb-&amp;gt;query('COMMIT');
    return true;
}

if (!function_exists('write_log')) {
    function write_log($log) {
        if (is_array($log) || is_object($log)) {
            error_log(print_r($log, true));
        } else {
            error_log($log);
        }
    }
}

&lt;/code&gt;&lt;/pre&gt;</description>
      <category>wordpress</category>
      <category>Bulk Delete</category>
      <category>bult posts</category>
      <category>REST API</category>
      <category>WordPress</category>
      <author>투한</author>
      <guid isPermaLink="true">https://javai.tistory.com/700</guid>
      <comments>https://javai.tistory.com/700#entry700comment</comments>
      <pubDate>Mon, 20 May 2024 20:22:02 +0900</pubDate>
    </item>
    <item>
      <title>spring mybatis mysql</title>
      <link>https://javai.tistory.com/698</link>
      <description>&lt;div style=&quot;text-align: center; &quot;&gt;&lt;div style=&quot;text-align: -webkit-auto; &quot;&gt;10만건에서 버벅이던 게시판이 100만건에서도 빠르게 돌아가게 수정이 되었습니다&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto; &quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto; &quot;&gt;분명 문제는 쿼리였던걸로 알고는 있었지만 어떻게 튜닝 해야되는지....찾던중 좋은글이 있어서 올립니다&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto; &quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto; &quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto; &quot;&gt;&lt;a href=&quot;http://dev.kthcorp.com/2012/05/22/mysql-low-performance-query-bad-habit/&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot;&gt;http://dev.kthcorp.com/2012/05/22/mysql-low-performance-query-bad-habit/&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto; &quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto; &quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto; &quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto; &quot;&gt;요약하자면 oracle 처럼 rownum을 생성하여 사용할 경우 mysql은 상당한 퍼포먼스 저하가 발생하게 되네요..&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto; &quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto; &quot;&gt;1초걸리던것이 4초 이상까지도 걸리는걸 확인했으니깐요&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto; &quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto; &quot;&gt;그리고 mysql은 dbengine이 있는데 innodb 에서&amp;nbsp;MyISAM 로 바꾸었구요 (count 할경우 4배속도 가량의 차이)&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto; &quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto; &quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto; &quot;&gt;총개수 구하는 부분, 리스트 가져오는 부분 의 쿼리들이 수정되었고&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto; &quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto; &quot;&gt;테이블 생성하는 docs의 폴더의 sql 문장도 수정되었습니다&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto; &quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto; &quot;&gt;selectList.jsp는 rnum -&amp;gt; idx 로 변경되었습니다&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto; &quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto; &quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto; &quot;&gt;&lt;b&gt;한마디로 Mysql은 무료지만 '까다롭다'&lt;/b&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: center; &quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: center; &quot;&gt;&lt;b&gt;7월11일 최신소스&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: double; border-right-style: double; border-bottom-style: double; border-left-style: double; border-top-width: 3px; border-right-width: 3px; border-bottom-width: 3px; border-left-width: 3px; border-top-color: rgb(121, 165, 228); border-right-color: rgb(121, 165, 228); border-bottom-color: rgb(121, 165, 228); border-left-color: rgb(121, 165, 228); background-color: rgb(219, 232, 251); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;&lt;div&gt;&lt;p&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block;   height: auto; max-width: 100%;&quot;&gt;&lt;a href=&quot;https://t1.daumcdn.net/cfile/tistory/166E493F4FFCF5740A&quot;&gt;&lt;img alt=&quot;&quot; src=&quot;https://i1.daumcdn.net/cfs.tistory/v/0/blog/image/extension/unknown.gif&quot; style=&quot;vertical-align: middle;&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;spring_board_mysql.zip.001&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block;   height: auto; max-width: 100%;&quot;&gt;&lt;a href=&quot;https://t1.daumcdn.net/cfile/tistory/1765A43F4FFCF57811&quot;&gt;&lt;img alt=&quot;&quot; src=&quot;https://i1.daumcdn.net/cfs.tistory/v/0/blog/image/extension/unknown.gif&quot; style=&quot;vertical-align: middle;&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;spring_board_mysql.zip.002&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;예전 소스&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: double; border-right-style: double; border-bottom-style: double; border-left-style: double; border-top-width: 3px; border-right-width: 3px; border-bottom-width: 3px; border-left-width: 3px; border-top-color: rgb(121, 165, 228); border-right-color: rgb(121, 165, 228); border-bottom-color: rgb(121, 165, 228); border-left-color: rgb(121, 165, 228); background-color: rgb(219, 232, 251); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;&lt;p&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block;   height: auto; max-width: 100%;&quot;&gt;&lt;a href=&quot;https://t1.daumcdn.net/cfile/tistory/204A4E3D4FE195BC30&quot;&gt;&lt;img alt=&quot;&quot; src=&quot;https://i1.daumcdn.net/cfs.tistory/v/0/blog/image/extension/unknown.gif&quot; style=&quot;vertical-align: middle;&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;spring_board_mysql.zip.001&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block;   height: auto; max-width: 100%;&quot;&gt;&lt;a href=&quot;https://t1.daumcdn.net/cfile/tistory/18615E3D4FE195BE11&quot;&gt;&lt;img alt=&quot;&quot; src=&quot;https://i1.daumcdn.net/cfs.tistory/v/0/blog/image/extension/unknown.gif&quot; style=&quot;vertical-align: middle;&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;spring_board_mysql.zip.002&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;/div&gt;&lt;p&gt;aaaa&lt;/p&gt;</description>
      <category>개발노트</category>
      <author>투한</author>
      <guid isPermaLink="true">https://javai.tistory.com/698</guid>
      <comments>https://javai.tistory.com/698#entry698comment</comments>
      <pubDate>Wed, 20 Jun 2012 18:21:26 +0900</pubDate>
    </item>
    <item>
      <title>파일 다운로드</title>
      <link>https://javai.tistory.com/697</link>
      <description>&lt;p&gt;현재의 폴더 위치를 얻은후에 폴더/파일명에 접근합니다&lt;/p&gt;&lt;p&gt;파일명이 계속 달라져야 하는 경우 jsp에서 submit 하면 되겠습니다&lt;/p&gt;&lt;p&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/p&gt;&lt;pre class=&quot;brush:java&quot;&gt;&lt;p&gt;String filename = &quot;파일명&quot;;

			String path = &quot;/&quot;;   

			ServletContext context = getServletContext();
			String absFolder = context.getRealPath(path);   

			System.out.println(absFolder);


			String filePath = absFolder+&quot;/폴더/&quot;; 
			InputStream in = null;
			OutputStream os = null;
			File file = null;
			File viewFile = null;
			boolean skip = false;
			String client = &quot;&quot;;

			try {
				String fname1 = &quot;&quot;;
				String fname2 = &quot;&quot;;
				String fname = &quot;&quot;;
				fname = filename;
				fname1 = new String(fname.getBytes(&quot;8859_1&quot;), &quot;utf-8&quot;);

				try {
					file = new File(filePath, fname);
					viewFile = new File(filePath, fname1);
					//out.print(&quot;file : &quot; + file);
					in = new FileInputStream(file);
				} catch (FileNotFoundException fe) {
					skip = true;
				}//catch

				fname2 = new String(fname1.getBytes(&quot;utf-8&quot;), &quot;8859_1&quot;);

				response.reset();
				client = request.getHeader(&quot;User-Agent&quot;);
				response.setContentType(&quot;application/x-msdownload;&quot;);
				response.setHeader(&quot;Content-Description&quot;, &quot;JSP Generated Data&quot;);

				if (!skip) {
					if (client.indexOf(&quot;MSIE 5.5&quot;) != -1) {
						response.setHeader(&quot;Content-Type&quot;,
								&quot;doesn/matter; charset=utf-8&quot;);
						response.setHeader(&quot;Content-Disposition&quot;, &quot;filename=&quot;
								+ new String(fname.getBytes(&quot;utf-8&quot;), &quot;8859_1&quot;));
					} else {
						response.setHeader(&quot;Content-Type&quot;,
								&quot;application/octet-stream; charset=utf-8&quot;);
						response.setHeader(
								&quot;Content-Disposition&quot;,
								&quot;attachment; filename=&quot;
										+ new String(fname.getBytes(&quot;utf-8&quot;),
												&quot;8859_1&quot;));
					}//else
					response.setHeader(&quot;Content-Transfer-Encoding&quot;, &quot;binary;&quot;);
					response.setHeader(&quot;Content-Length&quot;, &quot;&quot; + file.length());
					response.setHeader(&quot;Pragma&quot;, &quot;no-cache;&quot;);
					response.setHeader(&quot;Expires&quot;, &quot;-1;&quot;);

					os = response.getOutputStream();
					byte b[] = new byte[4096];
					int leng = 0;
					while ((leng = in.read(b)) &amp;gt; 0) {
						os.write(b, 0, leng);
					}//while
				} else {
					//out.println(&quot;&amp;lt;script language='javascript'&amp;gt;&quot;);
					//out.println(&quot;alert('File Downloading Fail !!');&quot;);
					//out.println(&quot;&amp;lt;/script&amp;gt;&quot;);
					return;
				}//else
			} catch (Exception e) {
				System.out.println(e);
			} finally {
				if (in != null)
					in.close();
				if (os != null)
					os.close();
			}//finally
&lt;/p&gt;&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</description>
      <category>JSP/기본</category>
      <author>투한</author>
      <guid isPermaLink="true">https://javai.tistory.com/697</guid>
      <comments>https://javai.tistory.com/697#entry697comment</comments>
      <pubDate>Thu, 7 Jun 2012 10:24:25 +0900</pubDate>
    </item>
    <item>
      <title>절대 경로 구하기(서버 경로)</title>
      <link>https://javai.tistory.com/696</link>
      <description>&lt;br /&gt;
&lt;br /&gt;&lt;pre class=&quot;brush:java&quot;&gt;
&lt;%@ page contentType=&quot;text/html;charset=euc-kr&quot; %&gt;
&lt;%@ page import!=&quot;com.oreilly.servlet.MultipartRequest, com.oreilly.servlet.multipart.DefaultFileRenamePolicy,java.io.*,java.util.*&quot; %&gt;
&lt;%
String path = &quot;/&quot;;    //파일이 있는 현재 폴더
ServletContext context = getServletContext();
String absFolder = context.getRealPath(path);   //절대경로를 구하는 부분
%&gt;
&lt;%=absFolder%&gt;
&lt;/pre&gt;
&lt;br /&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</description>
      <category>JSP/기본</category>
      <author>투한</author>
      <guid isPermaLink="true">https://javai.tistory.com/696</guid>
      <comments>https://javai.tistory.com/696#entry696comment</comments>
      <pubDate>Tue, 5 Jun 2012 10:34:12 +0900</pubDate>
    </item>
    <item>
      <title>xml Url 파싱</title>
      <link>https://javai.tistory.com/695</link>
      <description>&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:java&quot;&gt;package com;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;

import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;

public class test {
	public static void main(String[] args){
		try {
			DocumentBuilderFactory f = DocumentBuilderFactory.newInstance();
			DocumentBuilder parser = f.newDocumentBuilder();

			Document xmlDoc = null;

			//전국
			//String url =&quot;http://www.kma.go.kr/weather/forecast/mid-term-xml.jsp?stnId=108&quot;;
			String url =&quot;http://www.kma.go.kr/weather/forecast/mid-term-rss.jsp?stnId=108&quot;;

			//강원
			//String url =&quot;http://www.kma.go.kr/weather/forecast/mid-term-rss.jsp?stnId=105&quot;;

			xmlDoc = parser.parse(url);

			// 루트 엘리먼트 접근
			Element root = xmlDoc.getDocumentElement();

			int length = root.getElementsByTagName(&quot;body&quot;).getLength();

			for (int i = 0; i &amp;lt; length; i++) {

				Node vNode = root.getElementsByTagName(&quot;location&quot;).item(i);
				System.out.println(&quot;location size : &quot;+root.getElementsByTagName(&quot;location&quot;).getLength());

				int asd = root.getElementsByTagName(&quot;location&quot;).getLength();

				for(int z = 0; z &amp;lt; asd; z++){

					vNode = root.getElementsByTagName(&quot;location&quot;).item(z);

					Node province
					= ((Element) vNode).getElementsByTagName(&quot;province&quot;).item(i);
					System.out.println(&quot;####province : &quot;+province.getTextContent());

					Node city
					= ((Element) vNode).getElementsByTagName(&quot;city&quot;).item(i);
					System.out.println(&quot;####city : &quot;+city.getTextContent());

					vNode = root.getElementsByTagName(&quot;data&quot;).item(z);

					//int size = 1;
					int size = root.getElementsByTagName(&quot;data&quot;).getLength();

					//System.out.println(&quot;#### SIZE : &quot;+size);

					for (int j = 0; j &amp;lt; size; j++) {
						Node numEf
						= ((Element) vNode).getElementsByTagName(&quot;numEf&quot;).item(0);
						System.out.println(&quot;#### &quot;+numEf.getTextContent()+&quot;일 후 예보&quot;);

						System.out.println(&quot;####city : &quot;+city.getTextContent());
						System.out.println(&quot;####province : &quot;+province.getTextContent());


						vNode = root.getElementsByTagName(&quot;data&quot;).item(j);


						Node tmEf
						= ((Element) vNode).getElementsByTagName(&quot;tmEf&quot;).item(0);
						System.out.println(&quot;####날짜 : &quot;+tmEf.getTextContent());

						Node wf  
						= ((Element) vNode).getElementsByTagName(&quot;wf&quot;).item(0);
						System.out.println(&quot;####날씨 : &quot;+wf.getTextContent());

						Node tmn
						= ((Element) vNode).getElementsByTagName(&quot;tmn&quot;).item(0);
						System.out.println(&quot;####최저온도 : &quot;+tmn.getTextContent());

						Node tmx
						= ((Element) vNode).getElementsByTagName(&quot;tmx&quot;).item(0);
						System.out.println(&quot;####최고온도 : &quot;+tmx.getTextContent());

						Node reliability
						= ((Element) vNode).getElementsByTagName(&quot;reliability&quot;).item(0);
						System.out.println(&quot;####날씨에 대한 신뢰도 : &quot;+reliability.getTextContent()+&quot;\n\n&quot;);
					}
				}
			}
		} catch (Exception e) {
			System.out.println(e.getMessage());
			System.out.println(e.toString());
		}
	}
}
&lt;/pre&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;


&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</description>
      <category>JSP/기본</category>
      <author>투한</author>
      <guid isPermaLink="true">https://javai.tistory.com/695</guid>
      <comments>https://javai.tistory.com/695#entry695comment</comments>
      <pubDate>Mon, 4 Jun 2012 11:33:10 +0900</pubDate>
    </item>
    <item>
      <title>xml Url 파싱</title>
      <link>https://javai.tistory.com/694</link>
      <description>&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:java&quot;&gt;String address =&quot;&quot;;
		try {

			//116.91722222222222,27.305833333333332
			//江西省抚州市黎川县


			// DOM Document 객체를 생성하는 단계
			DocumentBuilderFactory f = DocumentBuilderFactory.newInstance();
			DocumentBuilder parser = f.newDocumentBuilder();

			// XML 파일 파싱하는 단계
			Document xmlDoc = null;
			String url =&quot;http://map.dootms.com:8081/rgeocode/simple?key=c99d0ae1648e5610bd00c5126a4805132ee938ea5c8f5ac0b7ad23c110793ad1fcf4d3c8d41344d5&amp;amp;resType=xml&amp;amp;encode=utf-8&amp;amp;range=3000&amp;amp;roadnum=10&amp;amp;crossnum=3&amp;amp;poinum=10&amp;amp;retvalue=1&amp;amp;sid=7001&amp;amp;region=&quot;+CommonUtil.nvl(longs)+&quot;,&quot;+CommonUtil.nvl(lat)+&quot;&amp;amp;rid=434766&quot;;

			//String url =&quot;C:/Users/eric/Desktop/poilist.xml&quot;;
			// error position 114.30194444444444,30.711944444444445
			//118.48444444444445위도 : 38.07916666666667
			//String url = &quot;http://map.dootms.com:8081/rgeocode/simple?key=c99d0ae1648e5610bd00c5126a4805132ee938ea5c8f5ac0b7ad23c110793ad1fcf4d3c8d41344d5&amp;amp;resType=xml&amp;amp;encode=utf-8&amp;amp;range=3000&amp;amp;roadnum=10&amp;amp;crossnum=3&amp;amp;poinum=10&amp;amp;retvalue=1&amp;amp;sid=7001&amp;amp;region=&amp;amp;rid=434766&quot;;
			//String url = &quot;http://map.dootms.com:8081/rgeocode/simple?key=c99d0ae1648e5610bd00c5126a4805132ee938ea5c8f5ac0b7ad23c110793ad1fcf4d3c8d41344d5&amp;amp;resType=xml&amp;amp;encode=utf-8&amp;amp;range=3000&amp;amp;roadnum=10&amp;amp;crossnum=3&amp;amp;poinum=10&amp;amp;retvalue=1&amp;amp;sid=7001&amp;amp;region=&quot;+CommonUtil.nvl(longs)+&quot;,&quot;+CommonUtil.nvl(lat)+&quot;&amp;amp;rid=434766&quot;;

			xmlDoc = parser.parse(url);  // parse는 결과값이라고 생각하자

			// 루트 엘리먼트 접근
			Element root = xmlDoc.getDocumentElement();

			int length = root.getElementsByTagName(&quot;spatial&quot;).getLength();

			for (int i = 0; i &amp;lt; length; i++) {
				Node vNode = root.getElementsByTagName(&quot;province&quot;).item(i);

				//성
				Node province
				= ((Element) vNode).getElementsByTagName(&quot;name&quot;).item(0);

				vNode = root.getElementsByTagName(&quot;city&quot;).item(i);

				//시
				Node city
				= ((Element) vNode).getElementsByTagName(&quot;name&quot;).item(0);

				vNode = root.getElementsByTagName(&quot;district&quot;).item(i);
				//구
				Node district
				= ((Element) vNode).getElementsByTagName(&quot;name&quot;).item(0);


				//예외처리
				if(!root.getElementsByTagName(&quot;roadlist&quot;).item(i).getTextContent().equals(&quot;&quot;))
					vNode = root.getElementsByTagName(&quot;roadlist&quot;).item(i);
				else if (!root.getElementsByTagName(&quot;poilist&quot;).item(i).getTextContent().equals(&quot;&quot;))
					vNode = root.getElementsByTagName(&quot;poilist&quot;).item(i);
				else if(!root.getElementsByTagName(&quot;crosslist&quot;).item(i).getTextContent().equals(&quot;&quot;))
					vNode = root.getElementsByTagName(&quot;crosslist&quot;).item(i);

				//거리
				//vNode = root.getElementsByTagName(&quot;roadlist&quot;).item(i);
				//거리2
				//vNode = root.getElementsByTagName(&quot;poilist&quot;).item(i);
				//거리 3
				//vNode = root.getElementsByTagName(&quot;crosslist&quot;).item(i);

				//예외처리 2
				if(root.getElementsByTagName(&quot;crosslist&quot;).item(i).getTextContent().equals(&quot;&quot;) &amp;amp;&amp;amp; root.getElementsByTagName(&quot;poilist&quot;).item(i).getTextContent().equals(&quot;&quot;) &amp;amp;&amp;amp; root.getElementsByTagName(&quot;roadlist&quot;).item(i).getTextContent().equals(&quot;&quot;)){

					address += province.getTextContent(); //성
					address += city.getTextContent();	//시
					address += district.getTextContent(); //구

				}else{

					//거리 이름
					Node roadlist
					= ((Element) vNode).getElementsByTagName(&quot;name&quot;).item(0);

					//거리의 방위
					Node direction
					= ((Element) vNode).getElementsByTagName(&quot;direction&quot;).item(0);


					String direction2 =direction.getTextContent();

					direction2 = direction2.replace(&quot;East&quot;, &quot;东&quot;);
					direction2 = direction2.replace(&quot;West&quot;,&quot;西&quot;);
					direction2 = direction2.replace(&quot;South&quot;,&quot;南&quot;);
					direction2 = direction2.replace(&quot;North&quot;,&quot;北&quot;);


					//그 길까지의 거리
					Node distance
					= ((Element) vNode).getElementsByTagName(&quot;distance&quot;).item(0);

					address += province.getTextContent(); //성
					address += city.getTextContent();	//시
					address += district.getTextContent(); //구
					address += CommonUtil.nvl(roadlist.getTextContent());  //거리 이름
					address += CommonUtil.nvl(direction2);					//거리 방위
					address += CommonUtil.nvl(distance.getTextContent()); 	//떨어진 거리

				}

				System.out.println(&quot;###### address :&quot;+address);

			}
		} catch (Exception e) {
			System.out.println(e.getMessage());
			System.out.println(e.toString());
		}
&lt;/pre&gt;
&lt;br /&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</description>
      <category>자바/기본</category>
      <author>투한</author>
      <guid isPermaLink="true">https://javai.tistory.com/694</guid>
      <comments>https://javai.tistory.com/694#entry694comment</comments>
      <pubDate>Mon, 4 Jun 2012 10:55:46 +0900</pubDate>
    </item>
    <item>
      <title>JAVA 임시 비밀번호 생성</title>
      <link>https://javai.tistory.com/693</link>
      <description>&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:java&quot;&gt;	public static String shufflePasswd(int len) {

		if(len == 0) len = 10;
		
		char[] charSet = new char[]{
				'0','1','2','3','4','5','6','7','8','9'
				,'A','B','C','D','E','F','G','H','I','J','K','L','M'
				,'N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};

		int idx = 0;
		StringBuffer sb = new StringBuffer();
		for(int i=0; i&amp;lt;len; i++){
			idx = (int)(charSet.length*Math.random());
			sb.append(charSet[idx]);
		}
		
		//아이디값을 받아서 db update
		
		return sb.toString().toLowerCase();
	}

	public static void main(String[] args){
		System.out.println(&quot;임시비밀번호생성 Start&quot;);
		System.out.println(&quot;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&quot; + shufflePasswd(10) );
		System.out.println(&quot;임시비밀번호생성 End&quot;);
	}
&lt;/pre&gt;
&lt;br /&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</description>
      <category>JSP/기본</category>
      <category>비밀번호</category>
      <category>임시</category>
      <author>투한</author>
      <guid isPermaLink="true">https://javai.tistory.com/693</guid>
      <comments>https://javai.tistory.com/693#entry693comment</comments>
      <pubDate>Mon, 7 May 2012 13:33:15 +0900</pubDate>
    </item>
    <item>
      <title>위도 경도 거리 계산</title>
      <link>https://javai.tistory.com/691</link>
      <description>&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;검증되었습니다( 나로부터)&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;(C#소스는 있던데 java는 없어서 바꿔치기 하였슴)&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;표시 단위는 km입니다&lt;/div&gt;&lt;br /&gt;
&lt;pre class=&quot;brush:java&quot;&gt;public static double distance(double Lat1,double Long1, double Lat2, double Long2) {
		double dDistance = Double.MIN_VALUE;
		double dLat1InRad = Lat1 * (Math.PI / 180.0);
		double dLong1InRad = Long1 * (Math.PI / 180.0);
		double dLat2InRad = Lat2 * (Math.PI / 180.0);
		double dLong2InRad = Long2 * (Math.PI / 180.0);

		double dLongitude = dLong2InRad - dLong1InRad;
		double dLatitude = dLat2InRad - dLat1InRad;

		// Intermediate result a.
		double a = Math.pow(Math.sin(dLatitude / 2.0), 2.0) + 
				Math.cos(dLat1InRad) * Math.cos(dLat2InRad) * 
				Math.pow(Math.sin(dLongitude / 2.0), 2.0);

		// Intermediate result c (great circle distance in Radians).
		double c = 2.0 * Math.atan2(Math.sqrt(a), Math.sqrt(1.0 - a));

		// Distance.
		// const Double kEarthRadiusMiles = 3956.0;
		Double kEarthRadiusKms = 6376.5;
		dDistance = kEarthRadiusKms * c;

		return dDistance;
	}
&lt;/pre&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</description>
      <category>JSP/기본</category>
      <category>거리계산</category>
      <category>경도</category>
      <category>위도</category>
      <author>투한</author>
      <guid isPermaLink="true">https://javai.tistory.com/691</guid>
      <comments>https://javai.tistory.com/691#entry691comment</comments>
      <pubDate>Tue, 17 Apr 2012 16:56:34 +0900</pubDate>
    </item>
    <item>
      <title>AbstractExcelView 클래스를 이용한 엑셀 다운로드 구현</title>
      <link>https://javai.tistory.com/583</link>
      <description>&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: double; border-right-style: double; border-bottom-style: double; border-left-style: double; border-top-width: 3px; border-right-width: 3px; border-bottom-width: 3px; border-left-width: 3px; border-top-color: rgb(121, 165, 228); border-right-color: rgb(121, 165, 228); border-bottom-color: rgb(121, 165, 228); border-left-color: rgb(121, 165, 228); background-color: rgb(219, 232, 251); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;&lt;div&gt;&lt;p&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block;   height: auto; max-width: 100%;&quot;&gt;&lt;a href=&quot;https://t1.daumcdn.net/cfile/tistory/155666374F7B079D06&quot;&gt;&lt;img alt=&quot;&quot; src=&quot;https://i1.daumcdn.net/cfs.tistory/v/0/blog/image/extension/unknown.gif&quot; style=&quot;vertical-align: middle;&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;chap07.7z.001&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block;   height: auto; max-width: 100%;&quot;&gt;&lt;a href=&quot;https://t1.daumcdn.net/cfile/tistory/1738E5374F7B07A62B&quot;&gt;&lt;img alt=&quot;&quot; src=&quot;https://i1.daumcdn.net/cfs.tistory/v/0/blog/image/extension/unknown.gif&quot; style=&quot;vertical-align: middle;&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;chap07.7z.002&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: double; border-right-style: double; border-bottom-style: double; border-left-style: double; border-top-width: 3px; border-right-width: 3px; border-bottom-width: 3px; border-left-width: 3px; border-top-color: rgb(193, 193, 193); border-right-color: rgb(193, 193, 193); border-bottom-color: rgb(193, 193, 193); border-left-color: rgb(193, 193, 193); background-color: rgb(238, 238, 238); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; &quot;&gt;이전 게시물과 연관 있습니다&lt;br /&gt;
&lt;a href=&quot;http://javai.tistory.com/577&quot; target=&quot;_blank&quot;&gt;[JSP/Spring] - MultipartFile 인터페이스 사용하여 파일업로드,다운로드(자카르타 라이브러리)&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;p style=&quot;margin:0&quot;&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 376px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/2018C7504F56BE8B1B&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F2018C7504F56BE8B1B&quot; width=&quot;376&quot; height=&quot;40&quot; filename=&quot;이미지 01.png&quot; filemime=&quot;image/png&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
주소 입력&lt;/div&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p style=&quot;margin:0&quot;&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 470px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/171B77504F56BE8B1A&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F171B77504F56BE8B1A&quot; width=&quot;470&quot; height=&quot;271&quot; filename=&quot;이미지 02.png&quot; filemime=&quot;image/png&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
파일 저장 및 열기&lt;/div&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p style=&quot;margin:0&quot;&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 675px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/1416C9504F56BE8B1F&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F1416C9504F56BE8B1F&quot; width=&quot;675&quot; height=&quot;280&quot; filename=&quot;이미지 03.png&quot; filemime=&quot;image/png&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
나오는 내용&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: double; border-right-style: double; border-bottom-style: double; border-left-style: double; border-top-width: 3px; border-right-width: 3px; border-bottom-width: 3px; border-left-width: 3px; border-top-color: rgb(121, 165, 228); border-right-color: rgb(121, 165, 228); border-bottom-color: rgb(121, 165, 228); border-left-color: rgb(121, 165, 228); background-color: rgb(219, 232, 251); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; &quot;&gt;&lt;br /&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
dispatcherNonHtml-servlet.xml
&lt;pre class=&quot;brush:html&quot;&gt;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;

&amp;lt;beans xmlns=&quot;http://www.springframework.org/schema/beans&quot;
	xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
	xsi:schemaLocation=&quot;http://www.springframework.org/schema/beans   
       http://www.springframework.org/schema/beans/spring-beans-3.0.xsd&quot;&amp;gt;

	&amp;lt;!-- 파일 다운로드 --&amp;gt;
	&amp;lt;bean id=&quot;viewResolver&quot; class=&quot;org.springframework.web.servlet.view.BeanNameViewResolver&quot; /&amp;gt;
	&amp;lt;bean id=&quot;downloadController&quot; class=&quot;madvirus.spring.chap07.controller.DownloadController&quot; /&amp;gt;
	&amp;lt;bean id=&quot;download&quot; class=&quot;madvirus.spring.chap07.view.DownloadView&quot; /&amp;gt;
	
	
	&amp;lt;!-- 엑셀 다운로드 --&amp;gt;
	&amp;lt;bean id=&quot;pageRanksController&quot; class=&quot;madvirus.spring.chap07.controller.PageRanksController&quot; /&amp;gt;
	&amp;lt;bean id=&quot;pageRanks&quot; class=&quot;madvirus.spring.chap07.view.PageRanksView&quot; /&amp;gt;
	
&amp;lt;/beans&amp;gt;
&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
PageRanksView
&lt;pre class=&quot;brush:java&quot;&gt;package madvirus.spring.chap07.view;

import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import madvirus.spring.chap07.controller.PageRank;

import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.springframework.web.servlet.view.document.AbstractExcelView;

public class PageRanksView extends AbstractExcelView {

	@SuppressWarnings(&quot;unchecked&quot;)
	@Override
	protected void buildExcelDocument(Map&amp;lt;String, Object&amp;gt; model,
			HSSFWorkbook workbook, HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		HSSFSheet sheet = createFirstSheet(workbook);
		createColumnLabel(sheet);

		List&amp;lt;PageRank&amp;gt; pageRanks = (List&amp;lt;PageRank&amp;gt;) model.get(&quot;pageRanks&quot;);
		int rowNum = 1;
		for (PageRank rank : pageRanks) {
			createPageRankRow(sheet, rank, rowNum++);
		}
	}

	private HSSFSheet createFirstSheet(HSSFWorkbook workbook) {
		HSSFSheet sheet = workbook.createSheet();
		workbook.setSheetName(0, &quot;페이지 순위&quot;);
		sheet.setColumnWidth(1, 256 * 20);
		return sheet;
	}

	private void createColumnLabel(HSSFSheet sheet) {
		HSSFRow firstRow = sheet.createRow(0);
		HSSFCell cell = firstRow.createCell(0);
		cell.setCellValue(&quot;순위&quot;);

		cell = firstRow.createCell(1);
		cell.setCellValue(&quot;페이지&quot;);
	}

	private void createPageRankRow(HSSFSheet sheet, PageRank rank, int rowNum) {
		HSSFRow row = sheet.createRow(rowNum);
		HSSFCell cell = row.createCell(0);
		cell.setCellValue(rank.getRank());

		cell = row.createCell(1);
		cell.setCellValue(rank.getPage());

	}

}
&lt;/pre&gt;&lt;div&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: double; border-right-style: double; border-bottom-style: double; border-left-style: double; border-top-width: 3px; border-right-width: 3px; border-bottom-width: 3px; border-left-width: 3px; border-top-color: rgb(121, 165, 228); border-right-color: rgb(121, 165, 228); border-bottom-color: rgb(121, 165, 228); border-left-color: rgb(121, 165, 228); background-color: rgb(219, 232, 251); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; &quot;&gt;@SuppressWarnings&lt;br /&gt;
완벽한 문법임에도 노란색 줄이 간다(@SuppressWarnings(&quot;unchecked&quot;)를 안넣었을 경우)&lt;br /&gt;
코드에 영향은 없다&lt;br /&gt;
&lt;br /&gt;@Override가 있고 없고의 차이와 비슷&lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
&lt;br /&gt;데이터를 받고 creaColumnLabel-&amp;gt; 엑셀을 만드는 역할&lt;br /&gt;
그래서 순위와 페이지가 만들어지고&lt;br /&gt;
&lt;br /&gt;List&amp;lt;PageRank&amp;gt; pageRanks = (List&amp;lt;PageRank&amp;gt;) model.get(&quot;pageRanks&quot;);&lt;br /&gt;
&lt;br /&gt;pageRanks에서 데이터를 읽어와&lt;br /&gt;
&lt;br /&gt;createPageRankRow가 데이터를 처리&amp;nbsp;&lt;/p&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
PageRank
&lt;pre class=&quot;brush:java&quot;&gt;package madvirus.spring.chap07.controller;

public class PageRank {

	private int rank;
	private String page;
	
	public PageRank() {
	}
	
	public PageRank(int rank, String page) {
		this.rank = rank;
		this.page = page;
	}
	
	public int getRank() {
		return rank;
	}
	public String getPage() {
		return page;
	}
	
}
&lt;/pre&gt;&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
PageRanksController
&lt;pre class=&quot;brush:java&quot;&gt;package madvirus.spring.chap07.controller;

import java.util.ArrayList;
import java.util.List;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class PageRanksController {

	@RequestMapping(&quot;/pageRanks&quot;)
	public ModelAndView handleRequestInternal(){

		List&amp;lt;PageRank&amp;gt; pageRanks = new ArrayList&amp;lt;PageRank&amp;gt;();
		pageRanks.add(new PageRank(1,&quot;/bbs/mir2/list&quot;));
		pageRanks.add(new PageRank(2,&quot;/bbs/mir3/list&quot;));
		pageRanks.add(new PageRank(3,&quot;/bbs/changchun2/list&quot;));

		return new ModelAndView(&quot;pageRanks&quot;,&quot;pageRanks&quot;,pageRanks);
		
	}
}
&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: double; border-right-style: double; border-bottom-style: double; border-left-style: double; border-top-width: 3px; border-right-width: 3px; border-bottom-width: 3px; border-left-width: 3px; border-top-color: rgb(121, 165, 228); border-right-color: rgb(121, 165, 228); border-bottom-color: rgb(121, 165, 228); border-left-color: rgb(121, 165, 228); background-color: rgb(219, 232, 251); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&lt;p style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; &quot;&gt;데이터를 ArrayList에 만들어 낸다&lt;br /&gt;
&lt;br /&gt;ModelAndView 로 만들어 지고&lt;br /&gt;
&lt;br /&gt;BeanNameViewResolver가 낚아 챈다(xml)&lt;br /&gt;
&lt;br /&gt;&lt;br /&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</description>
      <category>JSP/Spring</category>
      <category>AbstractExcelView</category>
      <category>엑셀 다운로드</category>
      <author>투한</author>
      <guid isPermaLink="true">https://javai.tistory.com/583</guid>
      <comments>https://javai.tistory.com/583#entry583comment</comments>
      <pubDate>Tue, 3 Apr 2012 23:22:43 +0900</pubDate>
    </item>
    <item>
      <title>Spring 어노테이션(Annotation) 정리</title>
      <link>https://javai.tistory.com/690</link>
      <description>&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: double; border-right-style: double; border-bottom-style: double; border-left-style: double; border-top-width: 3px; border-right-width: 3px; border-bottom-width: 3px; border-left-width: 3px; border-top-color: rgb(121, 165, 228); border-right-color: rgb(121, 165, 228); border-bottom-color: rgb(121, 165, 228); border-left-color: rgb(121, 165, 228); background-color: rgb(219, 232, 251); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;&lt;p&gt;&lt;a href=&quot;http://www.egovframe.go.kr/wiki/doku.php?do=export_xhtml&amp;amp;id=egovframework%3Arte%3Aptl%3Aannotation-based_controller&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot;&gt;http://www.egovframe.go.kr/wiki/doku.php?do=export_xhtml&amp;amp;id=egovframework%3Arte%3Aptl%3Aannotation-based_controller&lt;/a&gt;
&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;http://dev.anyframejava.org/anyframe/doc/core/3.2.0/corefw/guide/annotation-dependencies.html&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot;&gt;http://dev.anyframejava.org/anyframe/doc/core/3.2.0/corefw/guide/annotation-dependencies.html&lt;/a&gt;
&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;http://gyumee.egloos.com/1026938&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot;&gt;http://gyumee.egloos.com/1026938&lt;/a&gt;
&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</description>
      <category>JSP/Spring</category>
      <category>annotation</category>
      <category>Spring</category>
      <author>투한</author>
      <guid isPermaLink="true">https://javai.tistory.com/690</guid>
      <comments>https://javai.tistory.com/690#entry690comment</comments>
      <pubDate>Tue, 27 Mar 2012 22:15:41 +0900</pubDate>
    </item>
  </channel>
</rss>