How to localize strings in java

Hi,I am a beginner.In my sample application,there is a query which gets executed when i click on a button and generates the result set from a database.I am passing a parameter when i click on button.But this is not working with any other locale.How to pass the locale specific string as the parameter and get the resultset.Kindly suggest if there is any encoding to convert strings.
Can any body plz help me out...It's very urgent.......
Thanks in advance

In my application,I am passing string as parameter.For example if i want an item called "Street Address " which is in "address" table in the database.I pass "Street Address" as paarmeter.I want to make this work on japanese locale also.I want an encoding scheme to get japanese string from this english and vice-versa.I think now i am clear.Please suggest me some way.
Thanks

Similar Messages

  • How to get String form java JTable row?

    Hello everybody,
    Can anybody tell me how to get value as String form java JTable row?

    I found solution:
            table.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseClicked(MouseEvent evt) {
                    if (evt.getClickCount() == 2){
                        int col = table.getSelectedColumn();
                        int row = table.getSelectedRow();
                        String tableUrl = ((String)table.getModel().getValueAt(row, col));
                        ur.openUrl(tableUrl);
            });

  • How can i encrypt an ddecrypt a string using java

    hai,
    can anybody know how to encrypt and decrypt a string using java..
    please if anybody help me with a small example and with code
    thanks
    ravi chandra

    hi,
    of course there are better ways to crypt your code, but the following 2 functions do their job....
    as far as i know java has an own api for crypting stuff.
    private String GetEncryptedString(String aCryptedString)
    String result = "";
    String str = aCryptedString;
    int[] asciiArray = new int[str.length()];
    for(int i = 0; i < asciiArray.length; i++)
    asciiArray[i] = (int)str.charAt(i);
    char tempChar = (char)(asciiArray[i]+3);
    result = result+tempChar;
    return result;
    private String GetDecryptedString(String aString)
    String result = "";
    String str = aString;
    int[] asciiArray = new int[str.length()];
    for(int i = 0; i < asciiArray.length; i++)
    asciiArray[i] = (int)str.charAt(i);
    char tempChar = (char)(asciiArray[i]-3);
    result = result+tempChar;
    return result;
    andi

  • How to search for upper/lower case using string using JAVA!!!?

    -I am trying to write a program that will examine each letter in the string and count how many time the upper-case letter 'E' appears, and how many times the lower-case letter 'e' appears.
    -I also have to use a JOptionPane.showMessageDialog() to tell the user how many upper and lower case e's were in the string.
    -This will be repeated until the user types the word "Stop". 
    please help if you can
    what i have so far:
    [code]
    public class Project0 {
    public static void main(String[] args) {
      String[] uppercase = {'E'};
      String[] lowercase = {'e'};
      String isOrIsNot, inputWord;
      while (true) {
       // This line asks the user for input by popping out a single window
       // with text input
       inputWord = JOptionPane.showInputDialog(null, "Please enter a sentence");
       if ( inputWord.equals("stop") )
        System.exit(0);
       // if the inputWord is contained within uppercase or
       // lowercase return true
       if (wordIsThere(inputWord, lowercase))
        isOrIsNot = "Number of lower case e's: ";
       if (wordIsThere(inputword, uppercase))
         isOrIsNot = "number of upper case e's: ";
       // Output to a JOptionPane window whether the word is on the list or not
       JOptionPane.showMessageDialog(null, "The word " + inputWord + " " + isOrIsNot + " on the list.");
    } //main
    public static boolean wordIsThere(String findMe, String[] theList) {
      for (int i=0; i<theList.length; ++i) {
       if (findMe.equals(theList[i])) return true;
      return false;
    } // wordIsThere
    } // class Lab4Program1
    [/code]

    So what is your question? Do you get any errors? If so, post them. What doesn't work?
    And crossposted: how to search for upper/lower case using string using JAVA!!!?

  • How to convert number to string in java

    hi how can i convert number to string in java
    something like
    public void Discription(Number ownerName){
    String.valueOf(ownerName);Edited by: adf009 on 2013/04/08 7:14 PM

    Yet another way of doing it is: ownerName.toString().
    If you are working in and IDE such as Netbeans or Eclipse, type a period after the object name. Wait a second or so. Eclipse/Netbeans Intellisense will show you a list of functions that object provides that you can choose from. toString() is one of them.

  • How do I compress a string with  java.util.zip - not a file ?

    How do I compress a string with java.util.zip?
    Is possible to compress something else except a file?

    Of course, compression works on bytes, not some higher level constructs like Strings or files.
    You can use the ZipOutputStream or DeflaterOutputStream for compression.
    And the javadoc for Deflater even has a code example of compressing a String.
    Edited by: Kayaman on May 22, 2011 5:04 PM

  • How to convert localization strings returned from RIDC calls?

    I'm using the RIDC API to extract some data from UCM, but I'm running into issues where some values returned from service calls are the actual localization strings ("wwDocTypeDesc_Application" for example), not their translated values.
    Is there a service or method I can use to translate the strings? Something that evaluates IdocScript perhaps?

    Hey Mike,
    Please refer the following link.
    http://www.corecontentonly.com/index.php/2008/09/16/executing-idocscript-from-java-page-merger/
    looks like customization is the way forward from here. Just create a custom service, call your default ucm service from withing and before you pass on results fetch the required variable and send back.
    I know this is something that should have been taken care be them.
    cheers,
    swapnil

  • How to get string value from xml in JSF??

    In JSF How to get string value from xml, .ini and properties file. I want to get string value from xml or text to JSF

    Just use the appropriate API's for that. There are enough API's out which can read/parse/write XML, ini and properties files. E.g. JAXP or DOM4J for xml files, INI4J for ini files and Sun's own java.util.Properties for propertiesfiles.
    JSF supports properties files as message bundle and resource bundle so that you can use them for error messages and/or localization.

  • Sending Hebrew Strings From Java to ABAP

    Hello everybody,
    I'm trying to send a string from WebDynpo Java code to a SAP transaction on the R3 system.
    When I'm sending a string in English it arrives correctly
    When I'm sending a string in Hebrew it arrives as a sequence of question marks.
    Does anyone knows what kind of conversions do I need to do so I'll be able to send Hebrew strings?
    Thanks in advance, Adi.

    Hi,
      When u say that you are sending a hebrew string did you localized ur string usig ResourceBundle class from your Webdynpro,check it first.
      Refer SAP OSS notes for how to send String other than English to R/3 system and detailed configuration required.
      Refer this for help on Localization,
    • Internationalization is used for adapting already existing Webdynpros application
    Without changing the source code so that they can be used in several multi lingual languages.
    • Here we keep text strings separately from the application source code in a particular format(keys & values) so they can be processed in the standard translation mechanism.
    • Here frequently used texts such as labels or titles are stored as java dictionary simple types objects.
    • To do internationalization, copy the automatically generated *.xlf files and save them under the new name in the same directory.
    • For eg :- file convention like <old filename>_<language key>.xlf. Ex:- For German use the language key de.
    • For a particular user the locale is specified by the User management engine.
    • If not the locale is handled by the browser setting(HTTP Headers)
    • If not the default locale specified by the application will be returned.
    • If not default locale of the Virtual Machine(VM) is returned
    • This locale is passed to java.lang.ResourceBundle in the J2EE engine.
    • This will load the physically existing resource bundle either from any one of the following :-
    Resource bundle of WD(if exists) or resource bundle of VM (if exists) or
    Resource Bundle of without language suffix(always exists) given by the developer.
      I will post if anything strikes me.
    Hope it helps.
    Regards,
    Guru

  • How do i run a java program an another directory?

    How do I run a java program that's in a different directory?
    I have been doing this in the command line:
    java "C:\Document and Settings\freeOn\Desktop\Java\Test\test"
    and I get
    Exception in thread "main" java.lang.NoClassDefFoundError:
    C:\Document and Settings\freeOn\Desktop\Java\Test\test
    I just thought there might be a quick way to do this and not
    have to cd to the following dir evertime i want to run an app in
    console.
    The test.java file is this:
    import java.io.*;
    public class test {
        public static void main(String args[]) {
          System.out.println("Testing.....");

    Ok I looked in the java help and found the classpath, this makes it alittle easier.
    java -cp C:\DOCUME~1\freeOn\Desktop\Java\Test\ test
    At least i can run this in the run dialog which makes it easier thanks for you help kota balaji

  • How do u get a Java method to call itself? Not working here.

    How do u get a Java method to call itself? Not working here. I am using the "this" keyword. Thanks.
    Below, I would like to call checkIt method in itself.
    Ex.
    public class ABC {
    public String checkIt(String abc){
    if....
    checkIt(abc);
    }

    Assuming you are getting stack overflows (likely if you're unfamiliar with recursive calls), you need to put some sort of check condition inside the method so it doesn't call itself endlessly (AKA "infinite recursion").

  • How can i  apply this  java program for  a jsp page?

    import java.io.*;
    import java.util.*;
    public class FileProcessing
      //create a vector container  for the input variables
         Vector variables = new Vector();
      //create a vector container for the constants
         Vector constants = new Vector();
      /*create a string expression container for the equation
         as read from the file */
         String expression = " ";
      //create double result container for the final result
         double result = 0;
         public boolean processFile(String filename,String delim)
          //index for values vector
              int num_values = 0;
          //index for constants vector
              int num_constants = 0;
          //current line being read from the external file.
              String curline = " ";
          //start reading from the external file
              try
                   FileReader fr = new FileReader(filename);
                   BufferedReader br = new BufferedReader(fr);
                   while(true)
                        curline = br.readLine();
                        if(curline == null)
                             break;
                    //determine the type of current interaction
                        boolean variable = curline.startsWith("input");
                        boolean constant = curline.startsWith("constant");
                        boolean equation = curline.startsWith("equation");
                        boolean output = curline.startsWith("result");
                   //on input variables
                        if(variable)
                          StringTokenizer st = new StringTokenizer(curline,delim);
                          int num = st.countTokens();
                          int count=0;
                          while(st.hasMoreTokens())
                               String temp = st.nextToken();
                               if(count==1)
                                    byte b[]= new byte[100];
                                    System.out.println(temp);
                                    System.in.read(b);
                                    String inputval = (new String(b)).trim();
                                    variables.add(num_values,inputval);
                                    num_values++;
                               count++;
                        // on constant values
                        if(constant)
                             StringTokenizer st = new StringTokenizer(curline,delim);
                             int num = st.countTokens();
                             int count = 0;
                             while(st.hasMoreTokens())
                                  String temp = st.nextToken();
                                  if(count==1)
                                       byte b[]= new byte[100];
                                       System.out.println(temp);
                                       System.in.read(b);
                                       String cons = (new String(b)).trim();
                                       constants.add(num_constants,cons);
                                       num_constants++;
                                  count++;
                        // on equation
                        if(equation)
                             StringTokenizer st = new StringTokenizer(curline,delim);
                             int num = st.countTokens();
                             int count = 0;
                             while(st.hasMoreTokens())
                                  String temp = st.nextToken();
                                  if(count==2)
                                       this.expression = temp;
                                  count++;
              // now we are ready to evaluate the expression
                       if(output)
                          org.nfunk.jep.JEP  myparser= new org.nfunk.jep.JEP();
                          myparser.setAllowAssignment(true);
                          for(int i=1;i<variables.size()+1;i++)
                             String name = "arg"+Integer.toString(i);
                             myparser.addVariable(name,new Double(variables.get(i-1)
                                                .toString()).doubleValue());
                          for(int i=1;i<constants.size()+1;i++)
                               String name = "arg" +Integer.
                                         toString(i+variables.size());
                               myparser.addConstant(name,new Double(constants.get(i-1).toString()));
                   //output is obtained as follows
                          myparser.parseExpression(expression);
                          result = myparser.getValue();
                          System.out.println("Assay value: "+result);
              catch(Exception e)
                   System.out.println(e.toString());
              return true;
         public static void main(String[] args)
              FileProcessing fp = new FileProcessing();
              fp.processFile("input.eqn",":");
    }//my text file name is: "input.eqn" (given below)
    input:Enter Value1:arg1
    input:Enter Value2:arg2
    input:Enter Value3:arg3
    constant:arg4
    constant:arg5
    Equation:arg1+arg2+arg3
    result:

    how can i apply this java program for a jsp pagewhy do you want to do this ?
    Your program reads from a file on the disk and formats based on a patterm.
    Jsp is not intended for such stuff.
    ram.

  • Convert String to java UTC date then to sql date

    Hi,
    I am trying to convert string (MM/dd/yyyy format) to UTC date time and store in the database.
    This is what I did:
    String dateAsString = "10/01/2007";
    SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy");
    formatter.setTimeZone(TimeZone.getTimeZone("GMT"));
    formatter.setLenient(false);
    java.util.date dateValue = formatter.parse(dateAsString, new ParsePosition(0));
    dateValue will be Sun Sep 30 20:00:00 EDT 2007 in UTC.
    Now I need to store this date and time to MS SQL database.
    I used the following code:
    java.sql.Date sqlDateValue = new java.sql.Date(parsedToDate.getTime());
    But this code give only the date, not time 2007-09-30
    Can anybody tell me how I can change this java date to sql date (or datetime?) so that I can get both date and time.
    Thanks,
    semaj

    semaj07 wrote:
    Hi,
    I am trying to convert string (MM/dd/yyyy format) to UTC date time and store in the database.
    This is what I did:
    String dateAsString = "10/01/2007";
    SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy");
    formatter.setTimeZone(TimeZone.getTimeZone("GMT"));
    formatter.setLenient(false);
    java.util.date dateValue = formatter.parse(dateAsString, new ParsePosition(0));
    dateValue will be Sun Sep 30 20:00:00 EDT 2007 in UTC.
    Now I need to store this date and time to MS SQL database.
    I used the following code:
    java.sql.Date sqlDateValue = new java.sql.Date(parsedToDate.getTime());
    But this code give only the date, not time 2007-09-30
    Can anybody tell me how I can change this java date to sql date (or datetime?) so that I can get both date and time.
    Thanks,
    semajTake a look at java.sql.Timestamp:
    http://java.sun.com/javase/6/docs/api/java/sql/Timestamp.html
    Edited by: hungyee98 on Oct 17, 2007 8:57 AM

  • Selection of Localizable.strings and .strings file naming?

    Hi Apple Developer Folks,
    In the process of embedding Internalization for strings in my project, I referred to the "InternationalMountains" sample code project.
    In that project there are three languages supported, English, French and Chinese.
    What I do not understand is why all three Localizable.strings files have been checked in Localization section of the File Inspector.
    This is the case for the other two such files, as well. 
    (See the full sized image at http://www.drake.org/images/AllThreeBoxes.jpg )
    Also, I have one other question:  "What is the suggested mechanism for controlling the NAMING of the Localizable.strings files?"
    If I wanted to name the files something like "StandardApp.strings" or "ProApp.strings" - where and how would that be accomplished?
    As it is, if the files are not named "Localizable.strings" - the NSLocalizedString(key, comment); calls do not work as intended.
    Thanks very much!

    I'm guessing that most use the default naming of the localization strings files, which are packaged with related localized files in the appropriate resource folder - your screenshot is just showing that there are three localizations for that name.
    You can use any name you want when creating a strings file - Foundation's NSLocalizedString just uses the default Localizable.string file name by calling NSBundle's localizedStringForKey:value:table: method with a nil value for the table.  You can use other names by calling that method or by using Foundation's NSLocalizedStringFromTable, passing the desired table name (the file to use).

  • How to export string in CDATA with the jaxb xml writer?

    How to export string in CDATA with the jaxb xml writer?
    It read CDATA no problem but it is lost on write.

    Found it:
    ### THIS WORKS WITH SUN JAXB REFERENCE IMPLEMENTATION. ###
    (Not tested with any other)
    In the xsd, you must create a type for your string-like element.
    Then associate a data type converter class to this new type, which will produce CDATA tags.
    Then you must set a custom characterEscapeHandler to avoid the default xml escaping in order to preserve the previously produced CDATA tag.
    Good luck.
    -----type converter-----
    import javax.xml.bind.DatatypeConverter;
    public class ExpressionConverter {
         * Convert an expression from an XML file into an internal representation. JAXB will
         * probably have already stripped off the CDATA encapsulation. As a result, this method
         * simply invokes the JAXB type conversion for strings but does not take any other action.
         * @param text an XML-compliant expression
         * @return a pure string expression
         public static String parse(String text) {
              String result = DatatypeConverter.parseString(text);
              return result;
         * Convert an expression from its internal representation to an XML-compliant version.
         * This method will simply surround the string in a CDATA block and return the result.
         * @param text a pure string expression
         * @return the expression encapsulated within a CDATA block
         public static String print(String text) {
              StringBuffer sb = new StringBuffer(text.length() + 20); //should add the length of the CDATA tags + 8 EOLs to be safe
              sb.append("<![CDATA[");
              sb.append(wrapLines(text, 80));
              sb.append("]]>");
              return DatatypeConverter.printString(sb.toString());
         * Provides line-wrapping for long text strings. EOL indicators are inserted at
         * word boundaries once a specified line-length has been exceeded.
         * @param text the string to be wrapped
         * @param lineLength the maximum number of characters that should be included in a single line
         * @return the new string with appropriate EOL insertions
         private static String wrapLines(String text, int lineLength) {
              //wrap logic, watchout for quoted strings!!!!
              return text;
    ------in caller----
    Marshaller writer = ......
    writer.setProperty("com.sun.xml.bind.characterEscapeHandler", new NoCharacterEscapeHandler());
    -----escaper-----
    import java.io.IOException;
    import java.io.Writer;
    import com.sun.xml.bind.marshaller.CharacterEscapeHandler;
    public class NoCharacterEscapeHandler implements CharacterEscapeHandler {
         * Escape characters inside the buffer and send the output to the writer.
         * @param buf buffer of characters to be encoded
         * @param start the index position of the first character that should be encoded
         * @param len the number of characters that should be encoded
         * @param isAttValue true, if the buffer represents an XML tag attribute
         * @param out the output stream
         * @throws IOException if the writing process fails
         public void escape(char[] buf, int start, int len, boolean isAttValue, Writer out) throws IOException {
              for (int i = start; i < start + len; i++) {
                   char ch = buf;
                   if (isAttValue) {
                        // isAttValue is set to true when the marshaller is processing
                        // attribute values. Inside attribute values, there are more
                        // things you need to escape, usually.
                        if (ch == '&') {
                             out.write("&");
                        } else if (ch == '>') {
                             out.write(">");
                        } else if (ch == '<') {
                             out.write("<");
                        } else if (ch == '"') {
                             out.write(""");
                        } else if (ch == '\'') {
                             out.write("&apos;");
                        } else if (ch > 0x7F) {
                             // escape everything above ASCII to &#xXXXX;
                             out.write("&#x");
                             out.write(Integer.toHexString(ch));
                             out.write(";");
                        } else {
                             out.write(ch);
                   } else {
                        out.write(ch);
              return;

Maybe you are looking for

  • How to ignore the material with error in costing run ck40n

    Hi Pls, advice how to ignore parent material form costing run if the components of that material have errors. I need to run the costing run excluding erroneous parent item. Is any configuration on this.. Pls help.. K

  • Is there any file carver technology tool to recover from a HDD only a group of named jpg files

    Is there any file carver technology tool to recover from a HDD only a group of named jpg files that i lost? I lost 500 jpg files in my iPhoto library named i.e from 1.jpg to 500.jpg and I want to recover ONLY them from an 1TB external WD My Book e-sa

  • Interactive PDF's

    Hello all, I am using a Blackberry Z10 and need to fill in an Interactive PDF (generated by SAP). It does not seem that the native Adobe Reader works for this.  Does any one have any ideas, options, apps that would allow me to fill in Interactive PDF

  • NIMCInit.dll NI-PAL Service Manager Error

    Hello all, I'm getting the attached NI-PAL Service Manager error every time I start my computer.  I've tried solution given in this post: http://forums.ni.com/ni/board/message?board.id=240&message.id=4362 thread with no luck. If I uninstall the NI-Mo

  • Importing Oracle sqldeveloper 1.1 reports into Discoverer

    Hi All, I am new to Discoverer and i have a report file in XML format of Oracle SQL Developer 1.1. Can I import the report file into Discoverer and use them ? Is there any thing i need to take care of ?? Regards, Sam.