Solved

Internationalization (JSP)

Posted on 2003-11-20
6
893 Views
Last Modified: 2006-11-17
Hi,

I'm testing the following code in order to internationalize my application:

---------------------------------------------------------------------
      Locale locale = new Locale("de");
      ResourceBundle resources;
      resources = ResourceBundle.getBundle("Messages", locale);
      System.out.print(resources.getString("settings_settings"));
---------------------------------------------------------------------

This works in standard Java applications.
- But when the code is put into a JSP, the error message says, the resource cannot be found.

(Messages_de.properties is in the same folder as test.java, resp., test.jsp. I'm using the NetBeans IDE.)

What's wrong?

- Thanks.
0
Comment
Question by:robbert
6 Comments
 
LVL 15

Expert Comment

by:jimmack
ID: 9791372
Just a guess, but you should be able to test it quickly enough.

Try putting the resource file in the WEB-INF directory of your web app.
0
 
LVL 35

Expert Comment

by:TimYates
ID: 9791932
If that doesn't work, maybe consider using the i18n taglib from apache?

http://jakarta.apache.org/taglibs/doc/i18n-doc/
0
 
LVL 14

Accepted Solution

by:
kennethxu earned 200 total points
ID: 9793261
>> Messages_de.properties is in the same folder as test.java, resp., test.jsp. I'm using the NetBeans IDE.)
I think it should be in WEB-INF/classes dir.
0
ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

 
LVL 15

Expert Comment

by:jimmack
ID: 9796025
Oh.  It's in the *classes* subdirectory.

Thanks kennethxu.  I was close with my guess ;-)
0
 
LVL 15

Author Comment

by:robbert
ID: 9799779
Thank you, that way, it works - and please excuse that I'm trying to extend the question:

Actually, the JSP (in the root web) calls a method of a class (in WEB-INFO/somefolder/internat.java), passing the name of the properties bundle as a parameter. - Where should I put the .properties file??
0
 
LVL 14

Expert Comment

by:kennethxu
ID: 9801191
It doesn't matter where you java SOURCE file is.
I assume you have your java class in WEB-INF/classes, then the properties file should still in the same place.
0

Featured Post

ScreenConnect 6.0 Free Trial

Check out the updates in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI that improves session organization and overall user experience. See the enhancements for yourself!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Lamba in java 8 9 244
servlet concurrency 13 102
iterator example remove 8 74
Best practices to work on a spring MVC project 1 125
In this article we will learn how to backup a VMware farm using Nakivo Backup & Replication. In this tutorial we will install the software on a Windows 2012 R2 Server.
Data breaches are on the rise, and companies are preparing by boosting their cybersecurity budgets. According to the Cybersecurity Market Report (http://www.cybersecurityventures.com/cybersecurity-market-report), worldwide spending on cybersecurity …
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question