| | 40 | |
| | 41 | index.jsp |
| | 42 | {{{ |
| | 43 | #!java |
| | 44 | |
| | 45 | <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" |
| | 46 | import="java.io.*,java.text.*,java.util.*,javax.servlet.jsp.*" %> |
| | 47 | <%@ taglib uri="http://jakarta.apache.org/taglibs/i18n-1.0" prefix="i18n" %> |
| | 48 | |
| | 49 | |
| | 50 | |
| | 51 | <HTML> |
| | 52 | <HEAD> |
| | 53 | <TITLE>Examples of I18N Custom Tag Library |
| | 54 | Tag Usage</TITLE> |
| | 55 | </HEAD> |
| | 56 | <BODY> |
| | 57 | |
| | 58 | This page displays all key/value pairs in the bundle. |
| | 59 | |
| | 60 | locale = <b><%= pageContext.getResponse().getLocale() %></b><br> |
| | 61 | charset = <b><%= pageContext.getResponse().getCharacterEncoding() %></b><br> |
| | 62 | <H2>WebApp translations</H2> |
| | 63 | <% |
| | 64 | Locale locale = new Locale("zh",""); |
| | 65 | %> |
| | 66 | <i18n:bundle baseName="org.mytest.i18n" locale="<%=locale%>" id="bundle"/> |
| | 67 | <TABLE> |
| | 68 | <TR> <TD>1</TD><TD> <i18n:message key="test1"/></TD> </TR> |
| | 69 | <TR> <TD>2</TD><TD> <i18n:message key="test2"/></TD> </TR> |
| | 70 | </TABLE> |
| | 71 | |
| | 72 | |
| | 73 | </BODY> |
| | 74 | </HTML> |
| | 75 | }}} |
| | 76 | |
| | 77 | |