나눔 셈 연수 발표
아이디:04103021
발표인 :박학권
학과:전산
발표일:07/03/28
 Contents
1. Resource bundle
2. Bundle 주의할점
3. 동작원리&소스
4. 결과물
Resource bundle
The message resource class allows the developer
internationalising his web application easy and fast.
He can put labels of fields or discription textes in a
central file and can access them later in the JSP File.
The advantage is that you can reuse labels like error
messages, titles in multiple JSP files and you can
provide the ressource files in multiple languages.
Bundle 주의할점
1.Resources bundle 은 텍스트 에 쓰고 해도 된다.
2.저장할때 UTF-8 로 저장 하여야 한다..
3.eclipse에 사용될때 글씨가 깨여 진다.
A. 이럴땐 한글을 출력할려면 native2asc 로 한글을 아스키 코드로 바꿔야 한다.
경로는 c\JAVA\jdk\bin 속에서 찾아보면 있을것이다.
4. 아스키 코드로 전화 하여서 다른 번들 하나를 더 만든다.
이것은 수동으로 하여야 함.좀 번그럽지만 그래도 수고 해야지...
(후에 아스키 코드를 봐선 알수 없기에 하나 따로 한글로 해두면 뭔지 인차 대조 해볼
수 있음)
5. eclipse에 저장할때 두개 번들을 같이 저장한다..
예:org.nanumsem.struts.Library 안에 저장하여한다.
6. 이미지를 출력할때에는 경로를 메스드로 만들어서 출력하면 후에 유지보수 할때 많이
쉬워 진다.
따로 메스드를 만든다. 예 <%=Imagepath.getImagepath()%>
이것을 jsp 페이지에서 메소드를 만든것을 호출한것이고.
번들은 <bean:message key="키값"/>이렇게 하면 된다.
7.먼저 메소드나 빈으로 키값을 호출하기 전에 먼저 그 java 페이지를 import 시켜야 한
다.
예:<%@ page import="org.nanumsem.Library.Imagepath"%>
<%@ page import="org.nanumsem.Library.Msg"%>
동작원리&소스
1.Imagepath.getImagePath 를 인포트 한다.
2.다음 <%=Imagepath.getImagepath()%> 로 이미지 경로를 가져옴..
3.<bean:message key="키값"/>이거로 번들의 키값을 준다.
4.이미지를 출력하고 한글을 출력한다.
5.가끔 번들에서 줄 바꿈이 필요한데 이때에 번들에 <br> 로 줄 바꿈을 한
다..
동작원리&소스(jsp)
<%@ page language="java" pageEncoding="EUC-KR"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles"%>
<%@ page import="org.nanumsem.Library.Imagepath"%>
<%@ page import="org.nanumsem.Library.Msg"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html:html lang="true">
<head>
<html:base />
<title>message2.jsp</title>
<style type="text/css"></style>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<link rel="stylesheet" type="text/css"
href="../img/include/css/style.css">
</head>
<body >
<p>&nbsp;</p>
<p>&nbsp;</p>
<table width="320" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="6" height="6" class="MESSAGE_LEFT_TOP"></td>
<td height="6" class="OPEN_BG_TOP"></td>
<td width="6" height="6" class="MESSAGE_RIGHT_TOP"></td>
</tr>
동작원리&소스
<tr>
<td height="90%" class="OPEN_BG_LEFT"></td>
<td align="center" valign="top" class="T_CELL17_C">
<p><%=Msg.msg1()%></p>
<table onC lick="alert('안녕하세요!')" style='cursor:hand' width="70" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="10" class="BUTTONS03_L">&nbsp;</td>
<td width="13" class="BUTTONS03">
<img src="<%=Imagepath.getImagePath()%>
<bean:message key="img.message.alert.buttonO k"/>"width="13" height="24">
</td>
<td width="37" class="BUTTONS03">
<a href="#"> <bean:message key="img.message.alert.textOk" /></a>
</td>
<td width="10" class="BUTTONS03_R">&nbsp;</td>
</tr>
</table>
<td class="OPEN_BG_LEFT"></td>
<tr>
<td width="6" height="6" class="OPEN_BG_LEFT_BOTTOM"></td>
<td class="OPEN_BG_BOTTOM"></td>
<td class="OPEN_BG_RIGHT_BOTTOM"></td>
</tr>
</table>
<p>&nbsp;</p>
<table width="320" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="6" height="6" class="MESSAGE_LEFT_TOP"></td>
<td height="6" class="OPEN_BG_TOP"></td>
<td width="6" height="6" class="MESSAGE_RIGHT_TOP"></td>
동작원리&소스
</tr>
<tr>
<td height="90%" class="OPEN_BG_LEFT"></td>
<td align="center" valign="top" class="T_CELL17_C">
<p><%=Msg.msg2()%><br></p>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<table onC lick="alert('예!')" style='cursor:hand' width="70"border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="10" class="BUTTONS03_L">&nbsp;</td>
<td width="13" class="BUTTONS03">
<img src="<%=Imagepath.getImagePath()%>
<bean:message key="img.message.confirm.buttonY es"/>" width="13" height="24">
</td>
<td width="37" class="BUTTONS03">
<a href="#">
<bean:message key="img.message.confirm.textYes"/></a>
</td>
<td width="10" class="BUTTONS03_R">&nbsp;</td>
</tr>
</table>
</td>
<td width="5"></td>
<td>
<table onC lick="alert('아니요!')" style='cursor:hand' width="70" border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="BUTTONS03_L">&nbsp;</td>
<td class="BUTTONS03">
동작원리&소스
<img src="<%=Imagepath.getImagePath()%>
<bean:message key="img.message.confirm.buttonN o"/>" width="13" height="24">
</td>
<td class="BUTTONS03">
<a href="#">
<bean:message key="img.message.confirm.textNo" />
</a>
</td>
<td class="BUTTONS03_R">&nbsp;</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td class="OPEN_BG_LEFT"></td>
</tr>
<tr>
<td width="6" height="6" class="OPEN_BG_LEFT_BOTTOM"></td>
<td class="OPEN_BG_BOTTOM"></td>
<td class="OPEN_BG_RIGHT_BOTTOM"></td>
</tr>
</table>
<p>&nbsp;</p>
<table width="320" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="6" height="6" class="MESSAGE_LEFT_TOP"></td>
<td height="6" class="OPEN_BG_TOP"></td>
<td width="6" height="6" class="MESSAGE_RIGHT_TOP"></td>
</tr>
<tr>
동작원리&소스
<td height="90%" class="OPEN_BG_LEFT"></td>
<td align="center" valign="top" class="T_CELL17_C">
<p><%=Msg.msg2()%><br></p>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<table onC lick="alert('예!')" width="70" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="10" class="BUTTONS03_L"><br></td>
<td width="13" class="BUTTONS03">
<img src="<%=Imagepath.getImagePath()%>
<bean:message key="img.message.multi_confirm.buttonY es"/>" width="13" height="24">
</td>
<td width="34" class="BUTTONS03">
<a href="#">
<bean:message key="img.message.multi_confirm.textYes" />
</a>
</td>
<td width="10" class="BUTTONS03_R">&nbsp;</td>
</tr>
</table>
</td>
<td width="5"></td>
<td>
<table onC lick="alert('모두예!')" width="70" border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="BUTTONS03_L"><br></td>
<td class="BUTTONS03">
<img src="<%=Imagepath.getImagePath()%>
<bean:message key="img.message.multi_confirm.buttonA llYes"/>" width="13" height="24">
동작원리&소스
</td>
<td class="BUTTONS03">
<a href="#">
<bean:message key="img.message.multi_confirm.textAllYes" />
</a>
</td>
<td class="BUTTONS03_R">&nbsp;</td>
</tr>
</table>
</td>
<td width="5"></td>
<td>
<table onC lick="alert('아니요!')" style='cursor:hand' width="70" border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="BUTTONS03_L"><br></td>
<td class="BUTTONS03">
<img src="<%=Imagepath.getImagePath()%>
<bean:message key="img.message.multi_confirm.buttonN o"/>" width="13" height="24">
</td>
<td class="BUTTONS03">
<a href="#">
<bean:message key="img.message.multi_confirm.textNo" />
</a>
</td>
<td class="BUTTONS03_R">&nbsp;</td>
</tr>
</table>
</td>
<td width="5"></td>
동작원리&소스
<td>
<table onC lick="alert('취소!')" width="70" border="0" cellpadding="0" cellspacing="0" style='cursor:hand'>
<tr>
<td class="BUTTONS03_L"><br></td>
<td class="BUTTONS03">
<img src="<%=Imagepath.getImagePath()%>
<bean:message key="img.message.multi_confirm.buttonC ancel"/>" width="13" height="24">
</td>
<td class="BUTTONS03">
<a href="#">
<bean:message key="img.message.multi_confirm.textCancel" />
</a>
</td>
<td class="BUTTONS03_R">&nbsp;</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td class="OPEN_BG_LEFT"></td>
</tr>
<tr>
<td width="6" height="6" class="OPEN_BG_LEFT_BOTTOM"></td>
<td class="OPEN_BG_BOTTOM"></td>
<td class="OPEN_BG_RIGHT_BOTTOM"></td>
</tr>
</table>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
</body>
</html:html>
1단계 결과물
메세지창 나누기
<%@ page language="java" pageEncoding="EUC-KR"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>
<%@ page import="org.nanumsem.Library.Msg" %>
<% Msg.init(); %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="true">
<head>
<title>alertmessage.jsp</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!-<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body onr esize=setWindowSize()>
<%=Msg.msg3("")%>
</body>
메세지창 나누기
<script language=javascript >
window._w = document.getElementsByTagName('body')[0].clientWidth;
window._h = document.getElementsByTagName('body')[0].clientHeight;
function showMsg()
{
var dv = document.getElementById('msg1');
dv.style.visibility='visible';
dv.style.display='block';
dv.style.position="absolute";
var
var
var
var
//
w=dv.clientWidth;
h=dv.clientHeight;
scX = (screen.width - w)/2
scY = (screen.height - h)/2
dv.style.visibility='hidden';
dv.style.display='none';
dv.style.left=(window._w-dv.clientWidth)/2;
dv.style.top=(window._h-dv.clientHeight)/2;
var winstyle =
"toolbar=no,status=no,height="+h+",width="+w+",top="+scX+",left="+scY;
popwin = open("about:blank","win",winstyle);
popwin.document.write (dv.innerHTML);
}
showMsg();
function setWindowSize()
{
window._w = document.getElementsByTagName('body')[0].clientWidth;
window._h = document.getElementsByTagName('body')[0].clientHeight;
}
</script>
</html>
참고:
http://kr.blog.yahoo.com/harkkwon2/28.html?p%3D1%26pm%3Dl%26tc%3
D5%26tt%3D1175001545
http://hkpark.tistory.com/entry/Resource-Bundle
Descargar

슬라이드 1