[JSP]Webページマルチ言語処理

47615 ワード




ハングルセットの作成
title = \uC0C1\uD488 \uB4F1\uB85D
productId = \uC0C1\uD488 \uCF54\uB4DC
pname = \uC0C1\uD488\uBA85
uniPrice = \uAC00\uACA9
description = \uC0C1\uC138 \uC124\uBA85
manufacturer = \uC81C\uC870\uC0AC
category = \uBD84\uB958
unisInStock = \uC7AC\uACE0\uC218
condition = \uC0C1\uD0DC
productImage = \uC774\uBBF8\uC9C0
condition_New = \uC2E0\uADDC \uC81C\uD488
codition_Old = \uC911\uACE0 \uC81C\uD488
condition_Refurbished = \uC7AC\uC0DD \uC81C\uD488
button = \uB4F1\uB85D
英語バンドルパッケージの作成
title = Product Addition
productId = Product ID
pname = Name
uniPrice = Unit Price
description = Description
manufacturer = Manufacturer 
category = Category
unisInStock = Units in Stock
condition = Condition
productImage = Image
condition_New = New	
codition_Old = Old
condition_Refurbished = Refurbished
button = Insert
  • jspでバンドルパッケージを使用するには、ラベルライブラリを設定する必要があります.
  • <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
  • setLocaleから
  • まで
    ブーンと鳴る
    <%@ page language="java" contentType="text/html; charset=UTF-8"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
    <!DOCTYPE html>
    <html>
    <head>
    <link rel="stylesheet" href="/css/bootstrap.min.css">
    <script type="text/javascript" src="/ckeditor/ckeditor.js"></script>
    <script type="text/javascript" src="/js/validation.js"></script>
    <title>상품등록</title>
    </head>
    <body>
    	<!-- 파라미터 목록중  language의 값을 가져온다.-->
    	<fmt:setLocale value="${param.language }"/>
    	<fmt:bundle basename="resourceBundle.message">
    	<jsp:include page="/ch03/top.jsp" />
    	
    	<div class="jumbotron">
    		<div class="container">
    			<h1 class="display-3"><fmt:message key="title" /></h1>
    		</div>
    	</div>
    	
    	<div class="container">
    		<div class="text-right">
    			<a href="?language=ko">Korean</a>
    			<a href="?language=en">English</a>
    		</div>
    	<!-- addProduct_process.jsp => common-fileupload -->
    	<!-- addProduct_process2.jsp => cos.jar -->
    		<form name="newProduct" action="addProduct_process2.jsp" method="post" class="form-horizontal" enctype="multipart/form-data">
    		 <div class="form-group row">
    		 	<label class="col-sm-2"><fmt:message key="productId" /></label>
    		 	<div class="col-sm-3">
    		 		<input type="text" name="productId"  id = "productId" class="form-control" />	
    		 	</div>
    		 </div>
    		 
    		 <div class="form-group row">
    		 	<label class="col-sm-2"><fmt:message key="pname"/></label>
    		 	<div class="col-sm-3">
    		 		<input type="text" name="pname" id="pname" class="form-control" />	 		
    		 	</div>
    		 </div>
    		 
    		 	 <div class="form-group row">
    		 	<label class="col-sm-2"><fmt:message key="uniPrice"/></label>
    		 	<div class="col-sm-3">
    		 		<input type="text" name="uniPrice" id="uniPrice" class="form-control" />	 		
    		 	</div>
    		 </div>
    		 
    		 	 
    		 	 <div class="form-group row">
    		 	<label class="col-sm-2"><fmt:message key="description"/></label>
    		 	<div class="col-sm-5">
    		 		<textarea name="description" class="form-control"></textarea>	 		
    		 	</div>
    		 </div>
    		 
    		 <div class="form-group row">
    		 	<label class="col-sm-2"><fmt:message key="manufacturer"/></label>
    		 	<div class="col-sm-3">
    		 		<input type="text" name="manufacturer" class="form-control" />	 		
    		 	</div>
    		 </div>
    		 
    		 <div class="form-group row">
    		 	<label class="col-sm-2"><fmt:message key="category"/></label>
    		 	<div class="col-sm-3">
    		 		<input type="text" name="category" class="form-control" />	 		
    		 	</div>
    		 </div>
    		 
    		 <div class="form-group row">
    		 	<label class="col-sm-2"><fmt:message key="unisInStock"/></label>
    		 	<div class="col-sm-3">
    		 		<input type="text" name="unisInStock" id="unisInStock" class="form-control"/>	 		
    		 	</div>
    		 </div>
    		 
    		 <div class="form-group row">
    		 	<label class="col-sm-2"><fmt:message key="condition"/></label>
    		 	<div class="col-sm-5">
    		 		<input type="radio" name="condition" id="condition1" value="new" />
    		 			<label for = "condition1"><fmt:message key="condition_New"/></label>	
    		 		<input type="radio" name="condition" id="condition2"  value="Old" />
    					<label for = "condition2"><fmt:message key="codition_Old"/></label>	
    		 		<input type="radio" name="condition" id="condition3"  value="Refurbished" />	
    		 			<label for = "condition3"><fmt:message key="condition_Refurbished"/></label>	
    		 	</div>
    		 </div>
    		 
    <!-- 		 <div class="form-group row">
    		 	<label class="col-sm-2"> 이미지</label>
    		 		<div class="col-sm-5">
    		 			<input type="file" name="productImage" class="form-control" />
    		 		</div>
    		 </div> -->
    		 
    		 	 <div class="form-group row">
     		 	<label class="col-sm-2"> <fmt:message key="productImage"/></label> 
     		 		<div class="col-sm-5"> 
     		 			<input type="file" name="productImage2" class="form-control" />
     		 		</div>
     		 </div>
    		 
    		<div class="form-group row">
    			<div class="col-sm-offset-2 col-sm-10">
    				<input type="button" onclick="CheckAddProduct()" class="btn btn-primary" value="<fmt:message key="button"/>" />
    			</div>
    		</div>
    	</form>
    	</div>
    	
    <script type="text/javascript">
    CKEDITOR.replace("description")
    </script>
    	<jsp:include page="/ch03/bottom.jsp" />
    </fmt:bundle>
    </body>
    </html>