×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Resource Bundle

Resource Bundle

Resource Bundle

(OP)
Hi friends,
I worked with the resource bundle as an application and it worked fine.i have used the same concept in the servlet and the error log page in netscape application server say missing resource bundle but the bundle exits there. and
could u solve theis problem.iam working on solaris.whats the problem here.here is the code for the servlet.


import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class prope extends HttpServlet{
           public void doGet(HttpServletRequest req,HttpServletResponse res)
           throws ServletException,IOException
          {
                 PrintWriter out=res.getWriter();
                 Locale[] supportedLocales = {
              //  Locale.FRENCH,
                 Locale.GERMAN,
                Locale.ENGLISH
                 };
             try{
                 for (int i = 0; i < supportedLocales.length; i ++)
              {
                 out.println(displayValue(supportedLocales, "s2"));
              }
             }
              catch(Exception e)
{out.println(e);
}
                out.println();
                out.println(iterateKeys(supportedLocales[0]));
          }
           public  String displayValue(Locale currentLocale, String key)
             {
                   ResourceBundle labels =
                   ResourceBundle.getBundle("LabelsBundle",currentLocale);
                   String value  = labels.getString(key);
                    return "Locale = " + currentLocale.toString() + ", " +
                   "key = " + key + ", " +
                   "value = " + value;
              } // displayValue
public   String  iterateKeys(Locale currentLocale)
             {
                ResourceBundle labels =
                ResourceBundle.getBundle("LabelsBundle",currentLocale);
                Enumeration bundleKeys = labels.getKeys();
                String xt="";
                while (bundleKeys.hasMoreElements())
                {
                   String key = (String)bundleKeys.nextElement();
                   String value  = labels.getString(key);
                   xt=xt+"key = " + key + ", " +
                  "value = " + value;
                }
                 return xt;
              } // iterate keys
} // class

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close