Resource Bundle question

Can I keep HTML format in a resource bundle -properties file?
Anybody has expirience?

yep u can keep HTML format in Resource bundle..
basically if u get through reading of the Resource bundle u will find the answer by userself.
when u say resource bundle .getBundle it assumes a class to be opened instead of a property file..
and the key value pairs inside the property file is also readed the same way as that of the hashtable.
Infact all the keys are cached as a part of the hashtable.
and when u say bundle.getString(key) it returns u just a strings... whihc might contain any kind of string.
hope this answers ur question

Similar Messages

  • Resource Bundling question.

    Hi,
    I have a message in my resource bundle say:
    static final Object[] messages_ =
    { T2zosMessageKeys.MYDETAILS_,
    " My name is = {0} and my age is "{1}"},
    My question is when I invoke this message in my resource bundle , how do I supply the parameters to the arguments {0} and {1}?

    Well, if that's your resource file, I would say you need some sort of method to search and replace those parameters in the string.

  • Resource bundle question, where does it fit into package structure?

    I have a resource bundle but am getting an exception that says my resource bundle is not found (base type) of my OS local. I am not sure why.
    Here is my log...
    11 Apr 2009 10:40:09 AM suncertify.util.ErrorHandler handle
    SEVERE: Can't find bundle for base name SuncertifyExceptionBundle, locale en_ZA
    java.util.MissingResourceException: Can't find bundle for base name SuncertifyExceptionBundle, locale en_ZA

    Just some thaughts I would like to get opinions on. I felt I would create different bundles for Exception messages, and GUI text. I even go as far as creating a different bundle for each application mode, one for each different window(server, network, standalone). I want to know if I should let each of these classes call their respective bundle or should I let one class provide access to all resource bundles? Which is more favourable? I only ask because I have a application constants class that I am recoding and I could "convert it" to open the needed bundle properties file for the appropriate Strings?

  • Resources Bundle question

    I am using the following code to get the property file
    try {
    Res = ResourceBundle.getBundle("test.resources.uiRes", pLocale);
    } catch (MissingResourceException e) {
    System.out.println("Unqualified resource bundle name");
    where pLocale is a parameter.
    But it seems once the resource is load, I cannot reload the resource again in different locale. Anyone can give me some hints?
    Thanks

    Hmmm.... interesting - thanks for sharing it with us!
    I'm wondering if the main ResourceBundle you're using will only ever end up with the default system Locale, simply because you're never defining m_resource_bundle's Locale when you're creating it. Calling this.setLocale() the way you are certainly has the potential to be taking care of this, but whether or not it actually does is something I'm not sure of. Certainly one I'll have to try though!
    I have seen SwingUtilities.updateComponentTreeUI() work to an extent. If you're using a special font, resetting the font on all components before using this is often a very good idea, but it still doesn't force absolutely everything to repaint.
    One final thing to bear in mind for the newbies. If you're switching locales only, and not ResourceBundles, all the dates, times, currencies and other i18n data that Java carries within its i18n.jar will update automatically. You'll often need to set the font as mentioned above to get it all to display, but the way it all changes with one simple setLocale() call is excellent. If only ResourceBundles did the same!
    Hope that helps!
    Martin Hughes

  • How to deal with resource bundle in multiple applications system

    Hi all,
    I'm building new system depend on the method of
    one common model with multiple applications for the view objects
    my JDeveloper version 11.1.2.3
    my Question
    How can i merge the resource bundle for these applications
    as in the common model exists file for resouce bundle
    and each other applications contains resource bundle files how can i merge all these file in one Resource bundle file ?
    Edited by: 985756 on Apr 2, 2013 12:39 AM

    Hi,
    Please check anerjusb blog for your answer
    Hoping this will help you.
    http://andrejusb.blogspot.in/2009/12/reusing-resource-bundles-from-different.html
    Thanks & Regards,
    Vikas

  • Java: Loading Resource Bundle File with UTF-8

    I have found out all my previous problems now, thank you all for your assitance with this...
    During the time we have worked so solve our problem with UTF-8 charset we have found new problem with this?
    I don't know if this is the right forum to put this up, if not please let us know where to go with this?
    I have prepared both Eclipse (JSP Files) and GlassFish to run all my files in charset UTF-8. Then i got my
    resource bundle files(property files) to use UTF-8 encoding. Everything looks fine in my text editor. Then
    when i upload these pages every character retrieved from my resource bundles look garbled. This is because
    Java loads property files using ISO 8859-1 character encoding.
    This is a problem from Sun i have read on the internet!
    Note: that in JDK 1.6, you can use PropertyResourceBundle constructor to take a Reader which uses UTF-8 encoding.
    please have a look at these links for more info:
    [http://www.kai-mai.com/node/128]
    [http://java.sun.com/javase/6/docs/api/java/util/PropertyResourceBundle.html]
    Note: PropertyResourceBundle can be constructed either from an InputStream or a Reader, which represents a property file.
    Constructing a PropertyResourceBundle instance from an InputStream requires that the input stream be encoded in ISO-8859-1.
    In that case, characters that cannot be represented in ISO-8859-1 encoding must be represented by Unicode Escapes,
    whereas the other constructor which takes a Reader does not have that limitation.
    What i have read and understand is that the real solution to the problem is: Get the fmt lib to use a Reader instead of an
    InputStream. Alternativly if it works get a ResourceBundle instead of creating one that is wrong all the time? I have to create
    my own ResourceBundle instead of using my own fmt lib wich i cannot trust in a way any more. Is this right or am i comletly wrong?
    My WebTexts files, en, sv and ry are my resource property bundles. To be able to read them i will use resource property bundle reader.
    Fmt lib gives me this but it seems that it inciates this in an InputStream (wich is looked to iso-8859-1) instead of a reader who can
    read UTF-8 without no problem. So can i get my fmt lib to change this or not, anybody have an idea about this???

    Torleif wrote:
    Ok, i know there are a few ways of doing this already. The problem is that i have no idea how to use these different problem solving issues. First we have the;
    1. native2ascii command line utility.
    2. use the XML properties format.
    3. other ways of converting from iso-8859-1 to utf-8.
    The last one i have tried already but i never get this to work. So after knowing of 2 standardized solutions you choose to implement your own non-standard soltion? That's usually not a good idea until you've verified that the standardized solution don't help.
    This is also not the best solution to the problem i have to say. This way i will have both properties files and source files to work with and that is to much i think. Either i will use the native2ascii command or use XML properties format like you say here. I need some more insight in how these two work only because i have no idea my self.Uhm .. read [the documentation|http://java.sun.com/javase/6/docs/api/java/util/Properties.html]? loadFromXML/storeToXML work pretty much exactly the same as load/store, except they handle XML. Try it, look at what it produces, learn.
    Could you please help and explain how to use either this native2ascii command line work or how this XML format properties would work for me. Please i need guidance here with this!!![native2ascii is documented as well|http://java.sun.com/javase/6/docs/technotes/tools/windows/native2ascii.html].
    If you have a specific question after reading those, feel free to ask here.
    You really have to work on your Google-fu, it seems to be too weak.

  • Resource Bundles and Locales

    Hi!!
    I am researching Resource Bundles and how they work and have a question. Do you have to use Locales to determine which bundle to use? You see I am developing a product that will only be used in the US but will be used by several different companies. I would like to use a resource bundle for each company instead of for each country!! Is this possible? and if it is, how?
    Thanks for your time

    If you want to have default values, I would suggest using ResourceBundles and just sending in a Locale with the variant of the company. That way if your application ever needs to be localized it won't take much to change it. Your properties files would be named baseName_languageCode_CountryCode_Variant.properties.
    It has been a great advantage for the program that I am developing.

  • Resource bundles, loading in beans or in jsp or share them?

    Hi,
    I have a question and hope it is not a stupid one.
    What is the best way to work with resource bundles/messages developing faces application?
    One way is to load and use it in jsp. It is convenient and easy. Another is to use it within a bean. It's a little bit more complicated and might take more memory. Taking into account that sometimes general messages are to be used in both is there a guideline or some usual practice on how do I can access a resourcebundle that been loaded in jsp from bean?
    Suppose I have couple beans that might use the same messages - logically it is better to load bundle in jsp and use it from beans.
    Of course it could be loaded via faces config file, but some messages are needed only by couple of pages (registration for example).
    Please let me know your thoughts or how it is done usually.
    Thanks in advance!!

    You can use as many f:loadBundle tags in the JSP page as you want. You can also use them simultaneously with any <message-bundle> and/or <resource-bundle> declaration in the faces-config.xml. Just choose the one which covers the scope of the bundle in question.

  • Error resolving resource bundle "strings"

    Hi
    I'm trying to use Flex 3 to compile the Flex 2 PhotoViewer
    sample project, and encountered this error: 'Unable to resolve
    resource bundle "strings" for locale "en_US".'
    I found the Flex 2 TechNote which suggested to add
    "-use-network=false -library-path+=locale/{locale}
    -source-path+=locale/{locale} -locale=en_US" as compiler options.
    So I tried adding the above options into the build.bat files
    I can find at:
    a) C:\Program Files\Adobe\Flex Builder
    3\sdks\3.1.0\samples\explorer
    b) C:\Program Files\Adobe\Flex Builder
    3\sdks\3.1.0\templates\automation-runtimeloading-files
    but still the error persists.
    Can anyone please advise where I should change the compiler
    options? Thanks!
    Regards
    freshflex

    << Do not post the same question across a number of forums >>

  • Allowing EL expression in a resource bundles

    Mojarra 2.1.7-jbossorg-1 (20120227-1401)
    JBoss 7.1.1
    EL expressions in a resource bundle are currently not evaluated. That is, an an example, I have the following in the requiredMessage attribute of a JSF input control:
    requiredMessage="Status for #{someBean.documentMap[claimDocument.id].description} is required."I would like to move this to a messages.properties file like so:
    required.claimDocumentStatus=Status for #{someBean.documentMap[claimDocument.id].description} is required... so that the requiredMessage attribute becomes:
    requiredMessage="#{msg['required.claimDocumentStatus']}"Now the output for h:message(s) is
    Status for #{someBean.documentMap[claimDocument.id].description} is required.As I have found out, JSF resource bundles does not resolve EL expressions:
    http://stackoverflow.com/questions/6547136/el-variable-in-jsf-resourcebundle
    What I am trying to do is to allow such resolution / resolving to take place for JSF resource bundles. Now there is a class called "javax.el.ResourceBundleELResolver". I was wondering what it would take to extend this class to allow such a thing to take place. There does not seem to be a way to override it or to specify a custom resolver via faces-config.xml.
    Any thoughts ?
    Edited by: jmsjr on 14-Jan-2013 21:53

    jmsjr wrote:
    gimbal2 wrote:
    IMO this requirement, if it is possible to implement, is only going to lead to a hard to maintain application. But I guess that's something you have to experience before you believe it.
    You can't use EL directly in a resource bundle out of the box, but it is possible to parametrize them anyway, did you know that? Perhaps that is already good enough for you.
    http://murygin.wordpress.com/2010/04/23/parameter-substitution-in-resource-bundles/
    http://stackoverflow.com/questions/5697189/pass-parameters-to-messages-from-resource-bundle-to-components-other-than-hou
    Yes, I am aware of parameterising the resource bundles. However, these require you to use f:param .. and the last time I tried, these parameters were not available / visible at the requiredMessage attribute. I'll try it again anyway.As I have re-discovered, you cannot parameterise the requiredMessage attribute.
    http://stackoverflow.com/questions/9280915/how-to-parameterize-requiredmessage-attribute-in-composite-component
    The other alternative I am looking at, for the cases where the requiredMessage needs to be parameterised, or needs to have dynamic content, is to call a backing method for the requiredMessage attribute, from which I can then do whatever I need, even use EL expressions. I was thinking of this as a last resort.
    On the other hand, when one uses the validator attribute, usually one ends up adding one or multiple FacesMessage in code within the method being called, where the string of the message already comes from a resource bundle. I was trying to have a delineation whereby:
    1) requiredMessage should only use resource bundles, no backing bean method called.
    2) FacesMessages added via the method called by the validator attribute is OK

  • How to share a resource bundle throughout the faces application

    adf faces 11g release 1
    I want to implement the resource bundle as a java class extending the ListResourceBundle . That works fine for the local project.
    I then made one global "resource project" that should be shared in all projects. I tried first deploying the project to a adflib jar file,
    but i found that the resource class was not included ! I then deployed to a ordinary jar file and that works fine.
    My question is : Is that the way to make a shared resource bundle ?
    Regards,
    Jan

    Hi.
    Check following
    http://andrejusb.blogspot.com/2009/12/reusing-resource-bundles-from-different.html

  • How to use common resource bundle across all the development components ?

    Hi,
    I am working on SAP NetWeaver Developer Studio - JAVA
    How to use common resource bundle across all the development components ?
    Description :
    I have a requirement of creating a resource bundle (resource.properties) and use that common resource bundle in all the development components.
    Can we create a  development component (war and ear both) and create only resource.properties in this development component( DC ) and create the dependency of the same DC  in all the other DCs ?
    Thanks,
    Neha

    Hello Neha 
    This question is more NWDS related.
    You may have a better chance of someone answering the thread under
    SAP Netweaver -> SAP NetWeaver Development Infrastructure (NWDI, formerly known as JDI) forum
    Thanks
    Kenny

  • Resource bundle not found

    Hi,
    I would like to know where to put resource bundle file (it is, something.properties) to be seen in portal channel and background classes
    more info and workabout
    in my class I use resource bundle class Messages which loads resources from bundle "bundles.messages", (equals to file bundles/messages.properties).
    I copies this under /etc/opt/SUNWps/desktop/classes and restarted amserver
    then I created channe from JSPProvider, which displays one resource from this properties:
    <%=Messages.getString("token")%>, but I get on output:
    <pre>!token!</pre>,
    which means properties was not found.
    I havesame problem with third party .jar library which uses properties files. Even after copied oudsite the jar file (i know this must be done) they are not seen.
    thank you in advance,
    Petr Gasparik

    Thank you, vvlier, your advice helped me to move futher.
    I discovered that resource bundles (.properties files) must be directly in `classes` folder to be managed by Portal Server.
    I've put config.properties in /opt/SUNWps/web-src/WEB-INF/classes, then have run `deploy redeploy` command and in /var/opt/SUNWappserver7/domains/domain1/server1/applications/j2ee-modules/portal_1/WEB-INF/classes has appeared config.properties and config_en.properties, which means deploy somehow managed these files
    But still I was unable to fetch records from this file through my own Messages class
    Because this works from console, I have proof my code is working. Only that portal classloader is somewhat different.
    I've red through manual and found this page: http://docs.sun.com/source/817-5319/ch27.html but it doesn't help me.
    It even looks so that I have to use Portal Resource Bundle class?
    So, summary, I have one question:
    How to work with .properties files (Resource Bundles) in Portal?
    thank you in advance

  • Resource Bundles and Embedded fonts - best practice

    Hello,
    I am in digging into creating a localized app and I would
    like to use embedded fonts.
    Ideally, I would like to have two locales (for example), each
    with a different embedded font and/or unicode range.
    For example, how do I set up my localized app so that EN uses
    Arial (Latin Range), and JP uses Arial Unicode MS with Japanese
    Kanji unicode range ?
    Note that I do know how to embed fonts with different ranges,
    I just don't know how to properly embed them into resource bundles
    and access them easily in style sheets.
    Thanks!
    -Daniel

    Hello!
    This is a very pertinent question, however as many things in life there is no one size fits all here.
    We basically recommend, as best practice, to allocate for each specific context only the estimated needed resources. These values should always come from a previous study on the network patterns/load.
    To accomodate for growth and scalability it is strongly advised to initially keep as many resources reserved as possible and allocate the unused resources as needed. To accomplish this goal, you should created a reserved resource class, as you did already, with a guarantee of 20 to 40 percent of all ACE resources and configure a virtual context solely with the purpose of ensuring that these resources are reserved.
    As you might already know ACE protects resources in use, this means that when decreasing a context's resources, the resources must be unused before then can be reused by other context. Although it is possible to decrease the resource allocations in real time, it typically requires additional overhead to clear any used resources before reducing them.
    Based on the traffic patterns, number of connections, throughput, concurrent SSL connections , etc, for each of the sites you will be deploying you will have a better idea on what might be the estimated needed resources and then assign them to each of the contexts. Thus this is something that greatly depends on customer's network environment.
    Hope this helps to clarify your doubts.

  • Avoid automatic resource bundle creation in JDeveloper?

    Hi! I have a question.
    My application consists of few modules - jar files. One module "Translations" is designed to supply the application with translations that are extracted from a database. So that module contains List resource bundle as a java class, let's call it DBbundle.java. The problem is when I try to use this bundle in other modules. When I set that DBbundle should be the label translations supplier for view objects in some other module, JDeveloper automatically creates that DBbundle in that same workspace, though I import "Translations" module in that workspace. I also set Project properties -> Resource bundle on a project to use DBbundle (from "Translations" module) and uncheck "Automatically Synchronize Bundle", "Warn About Hard-coded Translatable Strings" and "Always Prompt for Description" checkboxes.
    So every time I edit a view, JDeveloper automatically creates DBbundle in that project. This is very annoying "feature". Does anyone know how to avoid this kind of behaviour?
    This is how I set bundle on view objects
    <ResourceBundle>
            <JavaResourceBundle
                MsgBundleClass="framework.translations.resources.DBbundle"/>
    </ResourceBundle>
    The same goes for Project properties -> Resource bundle
    Please, anyone?
    I use JDeveloper 11.1.2.3.0.

    Please, no one knows?

Maybe you are looking for

  • BW error with Excel 2007

    Hi Expert, I found some critical issues that in Excel 2007 1, can not read 20000 records at one time, it will pop upan issue window with the error message "Client out of memory" , but it works well in Excel 2003. 2, When I tried to open the other rep

  • Bind variable and parameter problem

    Hello, I'm migrating a complex report from Oracle Report to BI Publisher. Now I have some problems with the bind variables. In order to explain the question clearly, I simplified the code as below. The value of e1 and sum1 can be generated correctly.

  • Excise to capture from PO

    Hi, My requirement is to capture excise value in pricing ( at the time of sales) from the Purchase order of that material. How to capture this? Rgds Gaurav

  • Webdynpro with multiple webservice

    hi am new to net weaver.. .  trying to import more than one web service in web dynpro application. Is this possible???? can anybody help me .. Thanks in advance....... regards Krish.

  • How to update some fields of EBAN in ABAP code

    Hi, all In my ABAP program, I have to update two fields of EBAN . But I could not find any function or BAPI about it. Would anyone out there be able to help. Many thanks Aysenur