Using the Extended Tag Library to display the localized JSP.

Enterprise Java
Internationalize Your Web Site

Gary Bollinger and Bharathi Natarajan
Listing 6. Using the Extended Tag Library to display the localized JSP.


<HTML>
<HEAD>
<TITLE> I18N Test Application </TITLE>
</HEAD>

<BODY bgcolor="midnightblue" >
<FONT color="white" >

<%@ page import= "i18n.NameBean, i18n.i18nLocale"
%>
<%@ taglib uri="i18n-taglib.tld"
    prefix="i18n"
%>

<%
   String locale = request.getParameter("locale");
   if(locale != null)
       i18nLocale.setLocale(locale);
%>

<jsp:useBean id="nameBean"
 class="i18n.NameBean"
 scope="session" />
<jsp:setProperty name="nameBean"
 property="*" />

<i18n:text> What is your name?
</i18n:text>
<br><br>

<% if(nameBean.getName() != null) { %>
   <B> <i18n:text> Hello </i18n:text>
       <%= nameBean.getName() %>!
   </B>
<% } %>

</FONT>

<FORM METHOD="post">
  <INPUT TYPE="text" NAME="name"
   SIZE="25">
  <INPUT TYPE="submit"
   VALUE="<i18n:text> Submit
          </i18n:text>">
  <INPUT TYPE="reset"
   VALUE="<i18n:text> Reset
          </i18n:text>">
</FORM>
</BODY>
</HTML>

Featured

Upcoming Events

AppTrends

Sign up for our newsletter.

I agree to this site's Privacy Policy.