Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Intenationalization JSF using Tomcat & Eclipse

 
Pamungkas Timotius
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi...

I'm new in JSF world, and I'm trying to attach internationalization into my web application. The problem is, I'm using Eclipse for learn, and (based on JSF in Action) the easiest way to put my properties file is within WEB-INF/classes. It works fine, but every time the project was cleaned up, I also lost my properties file.
Is there any way to put my properties file into, let's say, WEB-INF/faces/locales and tomcat recognize it? I've tried to set java build path from project proeperties, but still I got this message:

org.apache.jasper.JasperException: java.util.MissingResourceException: Can't find bundle for base name applicationBundle, locale en

which, unsurprisingly, disappear if i put my applicationBundle_en.properties directly under WEB-INF.

Any idea??
 
Pamungkas Timotius
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry, I meant under WEB-INF/classes
 
Michael Ku
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The container is using your application's class path to find the resources. If you want to place them somewhere esle in youe application, add that path (location) to your classpath
 
Pamungkas Timotius
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how can i do that in eclipse?
 
Michael Ku
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Its the classpath of your application server that needs to be set.
 
Tim Holloway
Bartender
Posts: 18419
60
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's a couple of approaches.

1. You can turn off the automatic cleanup option on builds

2. You can set up an additional builder that copies the file from a more stable location (I usually keep an "etc" folder in the project for stuff like this).

3. You can use Ant/Maven to do the actual building

I use the third approach most often (or 3+1), although solution 2 is perhaps the most elegant.
 
Pamungkas Timotius
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well, i'm trying to use my own ant script..
I think the script only need two steps:

1. copy my properties file from 'faces/locales' into 'WEB-INF/classes'
2. do the build (call eclipse build file...)

It's quite simple to do the first task, but what about the second? where is the build.xml for my project?
 
Denise L Smith
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if you're using eclipse you should be able to just put in a package that is in your Javasource folder - The IDE will build it into your classes file for you. Each time you build with your IDE it compiles your files and moves the files that are in your packages into you classes folder-check out your project navigator view!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!