Do you use listResourceBundle? How do you take care of images? (i.e. gifs/jpgs).
I have been trying to use listResourceBundle with JSP but I always get resource
not found exception even though my classes are in the same path. I am using JWS
2.0.

regards
Ee Ming


Klas Eriksson wrote:

> Hi
>
> Does anyone have any experience in localizing jsp
> pages? To have jsp-pages in 4 different languages for
> example.
>

One approach I've taken is to use java.util.ResourceBundle objects to contain
the
translations of template text on the page.  The various resource bundles for
each
language are packaged up into a single BundleBean with a getMessge() method that
takes a Locale and a message key as arguments.  Then, in the JSP page, I might
have
something like this:

    <jsp:useBean id="bundleBean" scope="application"
     type="com.mycompany.ResourceBundleBean" />

    <jsp:useBean id="localeBean" scope="session"
     type="java.util.Locale" />

    <jsp:useBean id="customerBean" scope="session"
     type="com.mycompany.Customer" />

    ...

    <table>
        <tr>
            <td align=right>
                <%= bundleBean.getMessage(localeBean, "prompt.name") %>
            </td>
            <td>
                <input name="name" type="text" size=50 maxlength=50
                 value="<%= customerBean.getName() %>">
            </td>
        </tr>
        ...
    </table>

    ...

The locale stored in the user's session is based on their choice of languages
from
those supported on the site, which they can change from a combo box in the
navigation bar or something like that.

Craig McClanahan

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

Reply via email to