On my JSF 2.1 Application with JDK 7, I searched for a solution to provide my users the possibility to save their preferred language. So, on the next login the language should received from the Database and replaced by the language from the default (Browser). My only problem is now, how to save the java.util.Locale in my database? After hours of googling I found a new functionality inside of JDK 7 that is the "forLanguageTag Factory Method". This method returns a Locale and only needs for that a IETF BCP 47 standard string.
This sounds really simple and great for me. But how can I get this "IETF BCP 47 standard"-String from an existing locale? I looked in the API but found nothing that is comparable to the "IETF BCP 47 standard".