Refreshing bundle class programmaticaly (Jdev 10)

I have Jdev 10.3.
My requirement is to allow users to switch between 2 languages and all labels must change to other language (with click on little image with flag - implemented by image link). Labels must be read from database tables.
I was inspired by Persisting Resource Bundle Changes blog in [http://lucbors.blogspot.com/2010/02/adf-11g-label-modifications-and.html] , which covers Jdev 11.
I created bundle class, which takes language code from session variable and re-query database table to get new labels. And it works, but only when page is initialy loaded.
I can't realize, how to refresh the bundle when user clicks in different flag/language. In the blog Luc Borse used ResourceBundle.getBundle(bundleName).clearCache() but it doesn't work in JDev 10.
I also make two bundles with hard-cored query for each language and then try to switch to other bundle class with:
FacesContext.getCurrentInstance().getApplication().setMessageBundle("BUNDLE_CLASS");
But no success.
So the question is how to force page to refresh/reload bundle class in Jdev 10?
Regards
Saso
Edited by: user594252 on Oct 12, 2010 12:11 AM

Hi Saso,
Will you be adding languages anytime soon? The simplest option would be to create to class extending the first with the right _<lang code> extension and simply pass the right Locale to the super constructor. This way there would be one instance of the bundle per language and you would not have this problem. Else you have to override the getObject method in your bundle class and check the current language at the time to always return the right language resource. The first solution force you to create a new class when a new language is to be added though. The second option doesn't, but it's less efficient CPU wise. The most generic option that would combine both benefit is quite complex as it require to create a custom class loader able to create bundle classes on the fly based on a template one. I wouldn't venture there myself so I won't recommend it.

Similar Messages

  • Message Bundle class not found

    Hello,
    i'm using JDev 10.1.3.3, and creating ADF BC application. When i've created the jspx page, went to it's Page Definition, and in Structure editor tried to add the Message Bundle file to this page - selected the "Generate Resource Bundle" from the context menu - i'm getting error "Class ...app_XXXPageDefMsgBundle not found" .
    Other pages in application got the same error.
    How can i solve this problem?

    And in the same time, Message Bundle classes for Entity Objects (XXXRowImplMsgBundle.java) are generating well, without any errors.

  • Problem refreshing the classes

    I have problem refreshing the class with Tomcat 4.1 Server. I make changes in my class and they just don't reflect unless I restart the server. I don't want to refresh the server all the time. Is there any setting by which I can tell the server not to the version ffrom the memory. I even deleted that class from the classes directory but still the server would not know it.
    Thank you

    Oop's I am sorry. I did some terrible mistake. I am really sorry.
    Please Ignore this question

  • JSF resource bundle class not found,

    When I put the resource bundle class in session-ejb.jar, it works fine. But when I moved the resource bundle class into web module web.war, JBoss AS complained: the resource bundle class were not found.
    In the web module, I put the bundle class under:
    /WEB-INFO/classes
    war file:
    /WEB-INF/classes/resource/Messages
    JSP file:
    <f:loadBundle basename="resource.Messages" var="bundle"/>
    Thanks for help.

    has anyone made the following example work in JBOSS?
    http://www.coreservlets.com/JSF-Tutorial/code/jsf-messages.zip
    I got error message:
    resouce bundle not found.
    The resource properties files are under WEB-INF/classes.
    Where to put resource bundle files?
    Can any one please shed some light? Thank you very much.

  • Create Message Bundle classes for EO objects in Jdeveloper

    How to create Message Bundle classes(extending JboResourceBundle) for an EO object using Jdeveloper. The ADFToyStoreDemo contains these bundle classes for the EO. However, when I complete create a new EO, I don't get a default Message Bundle class.

    Don't you get these when you add validation rules to the entity or default values / control hints, etc?

  • Class  Refresh for Class mapped through Relation not Query

    We have Class A which is root of Domain Object Tree for our Application.
    We have Class B. Relationship for A -> B is one to one with Use Indirection turned on.
    Back reference (B->A) is also one to one with Use Indirection turn on.
    When we try to do getB() on Class A (i.e. A.getB()). Query is fired only on first
    access call to get(). We have a query to get Class A which always refresh A
    but not B. We tried setting Caching Policy - Always refresh on Class Descriptor for
    Class B. But still the query is not fired on object B when A.getB() is called.
    I need to class to be always refresh as this can get added on deleted outside
    Toplink Application. Hence is always need to refresh the Class B.
    What should We do.

    Refreshing in TopLink is based on queries. When you are accessing getB(), you are simply resolving a Java reference. (ie A.b). If B must always be refreshed I would recommend not mapping A.b attribute. Instead getB() should always issue a refreshing query.
    --Gordon                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Why WLS do not refresh the class in CLASSPATH?

    as title, and I have set development mode.

    Hi,
    due to classloader hierarchies, classes on the system classpath can not
    be refreshed (HotDeployment). If you want to use HotDeployment, you will
    have to load your application (and classes) through a WAR or EAR file.
    Hope that helps,
    Nils
    airwing wrote:
    >
    as title, and I have set development mode.--
    ============================
    [email protected]

  • Best way to repaint/refresh JFrame classes.

    Hello everyone,
    I am developing a small application for my studies. I have several classes many representing a user form allowing interaction with my system.
    One of my first class instances is a Menu Screen from which the user can for example update their details. When the Update Details frame is closed by the user I invoke
    frameName.setVisible(false);
    frameName.dispose();This removes the Update Details frame and the Menu Screen is now fully visible.
    However this screen does not get refreshed and remains partially obscured by the background color of the JFrame, even if I bring say a browser to the foreground and then click the original Menu Screen to the foreground it does not refresh the Menu Screen and remains half painted.
    I was wondering about a few things.
    1. Is there a way of detecting when the current JFrame has just received the focus, at which point I could repaint the screen.
    2. Is there a way of Menu Screen discussed above being able to detect the closure of the Update Details JFrame (a separate class) and then take appropriate steps to repaint/refresh itself.
    3. Ideally what I would like to do is Hide the Menu Screen then allow the user to interact with their menu selection and then Un-hide the Meun Screen when the user is done interacting with their menu selection.
    4. Are there any tutorials on this type of thing, that anynone could direct me to.
    Thank you for your consideration.
    Cheers
    Mark

    Hello everyone,
    I am developing a small application for my studies. I
    have several classes many representing a user form
    allowing interaction with my system.
    One of my first class instances is a Menu Screen from
    which the user can for example update their details.
    When the Update Details frame is closed by the user I
    invoke
    frameName.setVisible(false);
    frameName.dispose();This removes the Update Details frame and the Menu
    Screen is now fully visible.
    However this screen does not get refreshed and remains
    partially obscured by the background color of the
    JFrame, even if I bring say a browser to the
    foreground and then click the original Menu Screen to
    the foreground it does not refresh the Menu Screen and
    remains half painted.
    I was wondering about a few things.
    1. Is there a way of detecting when the current JFrame
    has just received the focus, at which point I could
    repaint the screen.
    2. Is there a way of Menu Screen discussed above being
    able to detect the closure of the Update Details
    JFrame (a separate class) and then take appropriate
    steps to repaint/refresh itself.
    3. Ideally what I would like to do is Hide the Menu
    Screen then allow the user to interact with their menu
    selection and then Un-hide the Meun Screen when the
    user is done interacting with their menu selection.
    4. Are there any tutorials on this type of thing, that
    anynone could direct me to.
    Thank you for your consideration.
    Cheers
    Mark

  • Auto-refresh for classes

    Hi,
    Using edition 9, where is the feature to have updated classes automatically refreshed in the servers classes directory so that I don't have to restart the server for each update? This is locally/development, not production. I believe this feature is not recommended for live apps.
    Thanks

    Actually, what I was looking for was called dynamic reloading and I found the answer in another post. However it doesn't seem to work. I made a simple change to a class, recompiled, waited the 2 seconds for the polling to occur and re-ran the app. Is there something else I have to configure.
    Thanks
    Edited by: black_lotus on Oct 3, 2007 3:20 PM

  • Refreshing Helper Class Files? HELP!

    Hi -
              I have a webapplication which has a number of JSP files, HTML pages, and helper .java files. In working with the JSP files, I know that WL will automatically refresh them when they are modified. However, if I'm working with the helper .java files I have to reboot the server in order to see any modifications. Is there a way to automatically refresh these files? Any suggestions as to to good development setups for debugging these things?
              Thanks,
              Robert
              Software Engineer
              Carescience, Inc.
              

    In WebLogic 6.x you can hot-redeploy your web-app after you recompile classes in
              WEB-INF/classes.
              Also, for development convinience, you can look at using Resin (http://www.caucho.com) -
              it has an option to automatically compile .java files in WEB-INF/classes and it detects
              any changes to .java files (similar to how JSP works), and recompiles modified source
              files and redeploys web-app if nesessary.
              ROBERT BOND <[email protected]> wrote:
              > Hi -
              > I have a webapplication which has a number of JSP files, HTML pages, and helper .java files. In working with the JSP files, I know that WL will automatically refresh them when they are modified. However, if I'm working with the helper .java files I have to reboot the server in order to see any modifications. Is there a way to automatically refresh these files? Any suggestions as to to good development setups for debugging these things?
              > Thanks,
              > Robert
              > Software Engineer
              > Carescience, Inc.
              Dimitri
              

  • Bundle classes automatically into a JAR

    By a single command line, how can I bundle several compiled java classes (*.class files) into a jar file? Say, for example, I want to do something like this:
    javac *.class -someoption myClasses.jar
    That is, in the end, all my *.class-files are bundles in myClasses.jar. Any idea?

    Have a look at the tutorial about JARs. It will tell you about the jar command.

  • Refresh ADF view data (Jdev 10.1.3.3.0) after database changes

    Hi,
    I have created a JSP ‘search’ page that displays some search criteria for restricting the data that is displayed. The user enters the criteria and presses the ‘Excute’ button to display only those rows that meet the entered search criteria. This works just fine.
    I have also created a JSP page that allows the user to create a new row. The row is not added to the any BO view, but is instead created by a request to a service. This service creates the new row and returns the ID. This also works just as expected. If I query the database, the row is present.
    However, when I return to the above mentioned JSP ‘search’ page and execute the query using the ID as a search criterion (or if I do not enter any search criteria), the row is not displayed. The only way I can get the row to be displayed, is if I start a new session. (Close the application and open it again in a new browser.)
    I have looked at some similar questions on this forum, and some similar posts on other forums and blogs, but I have not found any solution to this problem. I’m assuming that the ADF framework is reading the rows from cache in stead of querying the database. I have already set RangeSize="-1", CacheResults="false" and Refresh="always" for the view iterator in the pageDef of the ‘search’ page. I have also tried clearing the iterator by calling the clearCache() method before calling the executeQuery method.
    Is there a way to force ADF to always query the database in stead of using the cache? Am I overlooking an obvious setting at some level? Any help is much appreciated.
    Regards,
    Marco.

    Hi,
    Well it seems that my question was not 100% complete. If I use an Oracle data source, the data from the database is reloaded when I execute a query. If however I use a MySQL data source, the data is not reloaded until I disconnect/connect the current browser session. All data source properties are equal so this is probably a driver problem. I have looked at all the caching parameters, but all parameters are defaulted to false (No caching). Has anyone else experienced a problem like this before?
    Regards,
    Marco.

  • ADF Library Jar: Bundle-Classes-Information for Declarative Component

    Hi,
    when we deploying some adf-taskflows as a adf library jar we can add some content with technical namings and user friendly strings.
    see the good adf code corner example: [url http://www.oracle.com/technetwork/developer-tools/adf/learnmore/52-taskflow-in-lib-169195.pdf]Advanced Tip: Customizing the ADF Task Flow name in the ADF libray (Page 16)
    Is this also possible for declarative components?
    Technology: ADF 11g / JDeveloper 11.1.1.4 / Fusion Stack (ADF BC / ADF Model / ADF Faces)
    best regards
    Martin

    Hi,
    no, unfortunately not
    Frank

  • Problem with refresh resource bundle...

    Hi Iam refreshing the resource bundle. Iam using the following code:
    hsModelServiceProvider.getInstance().setFallbackBindingContainerEL("");
    JhsModelService jhsService = JhsModelServiceProvider.getInstance().getJhsModelService();
    System.out.print("UserId is :"+userId);
    jhsService.getTransaction().executeCommand("begin APP_USER_CTXT_mgr.set_user('"+userId+"');end;");
    System.out.print("after execute command");;
    // refresh resource bundle
    MethodBinding refreshBundles = FacesContext.getCurrentInstance().getApplication().createMethodBinding("#{nls.refreshBundles}",new Class[] { ActionEvent.class});
    refreshBundles.invoke(FacesContext.getCurrentInstance(),new Object[] {null});
    Iam gettin the following error Upon executing
    ERROR (MessageFactory) -Failed to refresh bundle oracle.jheadstart.exception.JhsUserMessages due to null
    Please help me..
    Thanx in Advance!

    Hi Steven,
    I want to personalise the ADF Application depending the userpreference. I got a tutorial which uses JHeadstart(through refreshing the resource bundle) for the same, but I did not understand that clearly as I said Iam new to this. Can you please give me any sources which speak about the personalisation functionality in detail?
    Thanq

  • Resource bundle is not refreshed from DB table as expected

    Does anybody implement this approach successfully http://technology.amis.nl/2012/08/14/refresh-resource-bundle-from-within-the-adf-application-to-absorb-changes-in-database-backed-bundles to refresh bundle text on BC level (for EOs, VOs, validation texts, ...) in runtime from DB table (where we have stored bundle texts).
    Texts for VC level are refreshed nice, texts (control hints) for BC level are refreshed only first time after application is (re)installed, but after that not any more.
    We create SR for that and Oracle development say this is not a bug, but behaviour.
    But what is the point of having Bundle class for let say EO (http://docs.oracle.com/cd/E24382_01/web.1112/e16182/bcentities.htm#ADFFD183 - Example 4-5 Localized Entity Object Component Message Bundle for Italian), if we can't perform runtime proccessing to refresh sMessageStrings.
    Any idea?
    Regards,
    Sašo

    Hi,
    +"But what is the point of having Bundle class for let say EO"+
    The point is to allow applications to be translated into multiple languages so that - based on the user language setting - the application runs with native labels. This works well with the default properties or Java resource bundle in ADF BC. So what doesn't work is the solution you copied from the AMIS blog and you may want to reach out to them if this works for them and if not why. Oracle support is correct in that they cannot support 3rd party samples and demos
    Frank

Maybe you are looking for