How do I use a bean to determine which message bundle value to use?

Is there a way to use a bean to determine which message from my message bundle I use? I want to be able to call my bean in JSF/JSP page, have the bean return a String, and use that String to pick a message from my message bundle properties file. Now I can do this:
<h:outputText value="#{bundle.messageA}" />or this:
<h:outputText value="#{bean.messageName}" />where I have a method on the bean like this:
public String getMessageName(){
     if(someTest == true){
          return "messageA";
     } else {
          return "messageB";
}I want to combine the two so my bean determines which message I pick. I want to do this because I want to keep all the text a user sees in the message bundle file. However, based on the state of the bean, I want to display different messages.
Thanks in advance,

Ah this way. So you want that much of nasty if statements in the bean instead? ;)
Then make use of the fact that you also can access Map values using the brace notation. E.g.
<h:outputText value="#{bundle[bean.messageKey]}"/>Where getMessageKey() returns the message key, e.g. 'messageA' or 'messageB' and so on.

Similar Messages

  • How to determine which diskgroups a database is using

    We want to be able to determine which diskgroups a database is using. We have been using the following query which works but only if the database has open or had open the "right set of files" recently --
    SQL> select dg.name from v$asm_diskgroup_stat dg, v$asm_client c where dg.group_number = c.group_number and c.db_name = 'MYDB';
    If no archived logs have been generated in a while then the diskgroup that contains the FRA will no be listed in this query. We can cause the FRA diskgroup to show up if we archive the current log. Here is an example.
    SQL> select * from v$asm_client;
    GROUP_NUMBER INSTANCE_NAME
    DB_NAME  STATUS
    SOFTWARE_VERSION
    COMPATIBLE_VERSION
                5 +ASM
    DBI03    CONNECTED
    11.2.0.3.0
    11.2.0.0.0
    SQL> alter system archive log current;
    System altered.
    SQL> select * from v$asm_client;
    GROUP_NUMBER INSTANCE_NAME
    DB_NAME  STATUS
    SOFTWARE_VERSION
    COMPATIBLE_VERSION
                5 +ASM
    DBI03    CONNECTED
    11.2.0.3.0
    11.2.0.0.0
    GROUP_NUMBER INSTANCE_NAME
    DB_NAME  STATUS
    SOFTWARE_VERSION
    COMPATIBLE_VERSION
                7 +ASM
    DBI03    CONNECTED
    11.2.0.3.0
    11.2.0.0.0
    Notice how diskgroup "7" shows up after the log is archived? It appears that the instance for diskgroup "7" will eventually be drop off after some idle period. Is there a way to generate the list of diskgroups consistently?

    Hi,
    If your database was configured manually (i.e not using DBCA) you should check v$(datafile,controlfile,logfile,block_change_tracking,etc) and parameters of database (log_archive_dest,db_recovery_file_dest,spfile,etc) to map these info.
    If your database was configured using DBCA you can try it:
    $ srvctl config database -d <database_name> |grep "Disk Groups"

  • Is there a way to see the size of my ICloud backup files, so I can determine which one I want to use?

    Is there a way to see the size of my ICloud backup files, so I can determine which one I want to use?

    Go to Settings>iCloud>Storage & Backup>Manage Storage.  Your backups are listed at the top, along with their sizes.  Note: this will only list your most current backup.  You may have your previous two backups available too but you cannot access any size information about them.

  • HT1206 I buy apps in my iPhone using different Apple IDs. Which Apple ID should I use to authorize the computer when synchronizing iPhone with iTunes?

    I buy apps in my iPhone using different Apple ID. Which Apple ID should I use to authorize the computer when sync iPhone with iTunes?

    Hi again,
    After a little further research, it appears that you would need to create separate iTunes libraries in order to be able to continue to purchase and download previously purchased items on the same computer, for two different Apple IDs. Sorry - but my husband and I have had the library we sync with authorized for so long, that we have not run into this issue, but it appears that you will get an warning when you try to authorize the second ID on the same computer, indicating that another ID is already associated with it.
    So, you will probably have to set up separate iTunes libraries for each ID:
    http://www.imore.com/how-use-multiple-apple-ids-one-computer-and-itunes
    Sorry for any confusion - hope this helps!
    Cheers,
    GB

  • How can I scan my network to determine which PC is using static IP or DHCP?

    Hello friends,
    I`m using Spiceworks for couple of days alreadyand need some help on this - In another post i saw that via SpiceWorks I can see how many PCs are using DHCP or Static IP (http://community.spiceworks.com/topic/37663-how-can-i-scan-my-network-for-static-ip-s-without-checki...) but is for previous version of the program. Currently I`m running version 7.4.00059.
    Can someone point me in the right direction where can I fing this information?
    Thank you very much for the help.

    Get a sneak peek of VeeamCloud Connect Replication– Veeam’s new DRaaS technology for service providers:• Leverage the Veeam cloud gateway to set up customer connections, without the need for VPN.• Use proven Veeam replication technology to create standby VMs.• Use Veeam network extension appliances to give customers seamless connections between their production and DR sites.• Allow customers to start failover in a complete self-service way from a mobile-friendly web portal. See you 7/7. -- http://go.veeam.com/webinar-delivering-draas-veeam.htmlNote: This webinar is for service providers. If you’re a Veeam customer interested in using Cloud Connect Replication in Veeam Availability Suite v9, check out this on-demand webinar:http://www.veeam.com/videos/fast-secure-cloud-based-disaster-recovery-veeam-cloud-connect-6345.html

  • What determines which NLS_LANG registry key is used?

    I have a vb application that uses the MSDAORA.1 OLEDB provider. I have the app and the Oracle 8i (8.1.7) driver client installed on two PC's. One PC the HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\NLS_LANG (AMERICA_AMERICA.WE8ISO8859P1) key is used and the HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\HOME0\NLS_LANG key is ignored. I know because if I change the value to "NA" or something else the app chokes with error ORA-12705 (invalid or unknown NLS parameter . . .). On the second PC the HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\HOME0\NLS_LANG key is used, and the HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\NLS_LANG is ignored. The Oracle client was installed a little differently on the two PC's one from the CD, and another from an MSI package that contains the Oracle client install. Both PC's only have one home which is HOME0. Both PC's have the same directory names and structures for the Oracle client. I compared the registry settings between the two PC's are they are essentially identical. Where is it determined which NLS_LANG key is used? And what is the purpose of the HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\NLS_LANG key as opposed to the HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\HOME0\NLS_LANG key? Thanks, Brian Grear

    see if this helps: http://www.uwgb.edu/compserv/ehelp/macos/Excel_Shortcuts_Mac.pdf

  • How does the ask-to-buy notification determine which organizer's device to send it to?  I keep receiving notifications on my ipad but not my iphone.  my ipad does not have a data plan so if i'm not on wireless, i don't receive any notifications.

    How does the Family Share ask-to-buy notification determine which organizer's device to send it to?  I keep receiving notifications on my iPad, but not on my iPhone.  My iPad does not have a data plan so if I'm not on wireless, I don't receive any notifications.

    Did you ever receive a solution for this issue?

  • How to determine which fallback bundle was used?

    Hello,
    I have built a component that uses singleton factory classes to cache localized objects in that same factory. In the end the singleton factory either builds a new one or pulls from cache. The cached objects can be cached by keys like myObjectEN or myObjectENUS. If I use user locale to create these keys fallback situations are not handled properly. Example:
    1.) I am only providing a _en bundle.
    2.) A user who's locale is en generates an object twith en translations that us cached by key myObjectEN.
    3.) A user who's locale is en_US falls back to en & generates an object with en translations that is cached by key myObjectENUS if I use the users locale, which isn't correct.
    This results in the same object with english translations being cached twice by two different keys. I need my key to be drived from the resource bundle being used, and not the users locale, to cover fallback situations. Is there any way to do this?
    Thanks!
    Message was edited by:
    DougSteckel

    Thanks Marius.
    The wdController.getApplication method doesn't exist, but if found that this did work:
    wdComponentAPI.getApplication().getName()
    thanks for send me off in the right direction.
    Cheers,
    faB
    Message was edited by: faB

  • How do I use my Ipod for Karoake; which ap and anyway to use my jawbone jambox as a speaker. thank you, I am clueless....

    Can anyone help wth this question? I am trying to figure out if I can use what I have to give my daughter a karaoke holiday. Have the jawbone speaker and Ipod, now just how to do it. I know I will need a microphone....any suggestions will be most appreciated.

    I know this is old - but did you ever get this working. Thinking of getting a 780 ti card and I have an older mac with the mini-displayport too.

  • Help Determining Which Methods/Classes Are Being Used

    Hello,
    I'm having issues with my company's Java application and because I've luckily narrowed the classes down to a meager 30+ I need some help pinpointing my problem.
    I realize there are a lot of Java monitoring applets/applications and some are deployment-specific but I need something very detailed-- I haven't found the features I need.
    Specs:
    Jrun4, Java 1.4, Windows Server 2003
    I would like to have a monitor that tells me exactly (real-time) what classes, methods, variables, etc. are being called in real-time. Looking at the JRun launcher console for one process gives me this:
    Generating report:quadbase.reportdesigner.ReportAPI.QbReport with export type:PDF
    01/16 14:05:33 error Software caused connection abort: socket write error
    java.net.SocketException: Software caused connection abort: socket write error
            at java.net.SocketOutputStream.socketWrite0(Native Method)
            at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
            at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
            at jrun.servlet.io.MetricsOutputStream.write(MetricsOutputStream.java:75)
            at java.io.BufferedOutputStream.write(BufferedOutputStream.java:106)
            at jrun.servlet.http.WebOutputStream.write(WebOutputStream.java:64)
            at jrun.servlet.file.FileServlet.pipeData(FileServlet.java:419)
            at jrun.servlet.file.FileServlet.service(FileServlet.java:254)
            at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:91)
            at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)This is cute, but not really helpful. I would like to determine what was passed to the process, from where and what went wrong.
    For example,
    Instead of this:
    Generating report:quadbase.reportdesigner.ReportAPI.QbReport with export type:PDF
    01/16 14:05:33 error Software caused connection abort: socket write errorI would get something like this:
    Generating report:quadbase.reportdesigner.ReportAPI.QbReport with export type:PDF
            Page variables: test.jsp ($var1= "I'm"; $var2= "Going"; $var3="To"; $var4="Break"; $var5 = null)
            Calling: test2.jsp
            With: jrun.bin.db.foo.Bar();
    01/16 14:05:33 error Software caused connection abort: socket write error
            Problem: $var5 = null;Sorry if I'm rambling, I just want to know what is where and who it's calling when it breaks. Then I could deduce which class, what variable, what page, etc. My application is very complicated and seemingly mundane changes can throw it all off.
    Any ideas?

    We'll look into usage tracking. We're on the standard edition, so I'm not sure if it's available. Also, some of these reports may be quarterly -- so there may be a long wait to see if the view is used and I need to know fairly soon. (If it's not used, it saves us some work in a project transition going on.)
    I certainly don't understand the underlying structure of the product, but it seems like there should be some way to determine if a view is used by a report. I apologize if I'm not using the correct terminology. Thanks for your help -- we'll keep looking into it.

  • How do I find out the playlists in which a song is being used?

    I transfered my itunes library to my mac from my ipod after I lost the hard drive on which it was located for my PC. Now I have duplicate music files, which I want to eliminate without losing the songs in my workout playlists. Can you please help me? Thanks.

    right or control + click a song, then "show in playlist..."

  • Multi-mapping with message bundling but without using BPM

    Hi all,
    I have a requirement to bunch specific no. of records (say 50) from source message and create separate target messages for those bunches. For example, if the source message has 120 records, then there should be three separate target messages created containing 50, 50 and 20 records each.
    I am wondering whether this multi-mapping is possible without using BPM, as the typical no. of records in the source message are in the range of 600 to 800, and rarely (twice or thrice a month) they shoot up to 2000. So my concern is whether BPM would affect the performance. We are using PI at SP12.
    Regards,
    - Shankar.

    Sorry for late reply.. Well the sender is a file system, which sends a single XML file containing multiple records. (I mean I have a sender file adapter that polls periodically from a specific path and picks up the file when it is available)
    The no. of records in the source file may be different in each run. The requirement on the receiver system is that it can handle a file which has maximum of 'n' records only (say 50 in my example)
    Now the sender file can contain any no. of records. It may contain 10 on some day, or 200 the next day, or 120 on the third day. But on the receiver side, I want the files to be created such that each will contain AT MAX 50 records.
    So, if source file has <=50 records, then there will be only 1 target file having the same no. of records.
    If source file has between 51 to 100 records, then there will be two target files. One will have 50 records, and the second will have remaining records.
    And so on..
    Regards,
    - Shankar.

  • How to loop through a collection of records which is return value of func.

    Hi all.
    Have this situation:
    - Stored function (member of pkg procedure) that returns a collection of records.
    Package Spec:
    =========
    type tipo_pvt is table of s08_plan_venta_totalizado_r % rowtype;
    rc_pvt tipo_pvt;
    (s08_plan_venta_totalizado_r is a view).
    Package Body:
    =========
    select col1
    ,col2
    ,etc
    bulk collect into rc_pvt
    from s08_lista_precio_producto_r lpp
    ,s03_producto_r prd
    where condition;
    return rc_pvt;
    Once collection is loaded and returned (i know it loads records). I just want to loop through every record on a pl/sql procedure on the client (forms6i procedure), but it gives me the error: ORA-06531 Reference to uninitialized collection:
    On the forms6i client procedure i have something like:
    procedure p_carga_plan_venta_inv (p_id_plan_venta in number) is
    v_contador integer;
    v_mensaje varchar2(10);
    rc_pvt sk08_gestiona_plan_venta.tipo_pvt; (sk08_gestiona_plan_venta is package name)
    begin
         rc_pvt := sk08_gestiona_plan_venta.tipo_pvt();
         rc_pvt := sk08_gestiona_plan_venta.f_genera_plan_venta_inv (:pvv.lip_id_lista_precio
    ,:pvv.ems_id_sucursal
                                            ,:control4.v_metodo_calculo
    ,:pvv.unm_co_unidad_monetaria
    ,:pvp.fe_fin_periodo) ;
    -- previous statement dos not fail BUT THIS:
    message('rc_pvt.count= '||rc_pvt.count);pause;
    DOES FAIL
    end;
    So my question is : since i have already returned the collection, how come is not initialized....?
    Do i have to extend it first? In this case i have to return the number of records in the collection.....
    Look what happen when done from sqlplus:
    declare
    rc_pvt sk08_gestiona_plan_venta.tipo_pvt;
    begin
    rc_pvt := sk08_gestiona_plan_venta.tipo_pvt();
    rc_pvt :=
    sk08_gestiona_plan_venta.f_genera_plan_venta_inv (8713171
    ,null
    ,'m'
    ,'BS.F'
    ,to_date('28/02/2001','dd/mm/yyyy'));
    end;
    SQL> /
    Registros en la coleccion =6
    Procedimiento PL/SQL finalizado con éxito.
    SQL>
    I put a dbms_output.put_line on stored function .....
    Please help ....!
    Apparently it fails when calling the stored function:
    rc_pvt := sk08_gestiona_plan_venta.f_genera_plan_venta_inv (:pvv.lip_id_lista_precio
    ,:pvv.ems_id_sucursal
    ,:control4.v_metodo_calculo
    ,:pvv.unm_co_unidad_monetaria
    ,:pvp.fe_fin_periodo) ;
    I don't undestand since this function return the appropiate type. It seems the collection is empty, although having test that on sqlplus works ...
    rc_pvt := sk08_gestiona_plan_venta.f_genera_plan_venta_inv (:pvv.lip_id_lista_precio
    ,:pvv.ems_id_sucursal
    ,:control4.v_metodo_calculo
    ,:pvv.unm_co_unidad_monetaria
    ,:pvp.fe_fin_periodo) ;
    function f_genera_plan_venta_inv (p_id_lista_precio in number
    ,p_id_sucursal in number
    ,p_tipo_nivel_inv in varchar2
    ,p_co_unidad_monetaria in varchar2
    ,p_fe_fin_periodo in date) return tipo_pvt;
    for some reason it works on plus:
    SQL> declare
    2 rc_pvt sk08_gestiona_plan_venta.tipo_pvt;
    3 begin
    4 rc_pvt := sk08_gestiona_plan_venta.tipo_pvt();
    5 rc_pvt :=
    6 sk08_gestiona_plan_venta.f_genera_plan_venta_inv (8713171
    7 ,null
    8 ,'m'
    9 ,'BS.F'
    10 ,to_date('28/02/2001','dd/mm/yyyy'));
    11 --
    12 dbms_output.put_line('Registros en la coleccion = '||rc_pvt.count);
    13 for i in 1 .. rc_pvt.count loop
    14 --
    15 dbms_output.put_line('En '||i||rc_pvt(i).prd_co_producto);
    16 end loop;
    17 end;
    18 /
    Registros en la coleccion =6
    Registros en la coleccion = 6
    En 1PT.REF.PET.KO05
    En 2PT.REF.PET.LM15
    En 3PT.ALM.VDR.001
    En 4PT.REF.GRN.CN
    En 5PT.REF.GRN.KO
    En 6PT.REF.GRN.LM
    Procedimiento PL/SQL finalizado con éxito.
    Don't understand why it works on plus8 (same version that comes with 6i).
    Can't loop through records on forms...? WHY ...?
    Edited by: myluism on 02-abr-2012 14:40

    Forms 6i is an antique ... write your code to run on the server.
    Multiple examples of how to loop through an array loaded with bulk collect can be found here.
    http://www.morganslibrary.org/reference/array_processing.html
    The main library page is:
    http://www.morganslibrary.org/library.html

  • How to create unique constraint on a col which has duplicate values

    Hi all,
    how can i create a unique constraint on a field which have duplicate vaules with no validate clause.
    My table name is "ACCT"
    Regards
    Message was edited by:
    53637

    Check out following
    SQL>DROP TABLE TEST;
    Table dropped.
    SQL>CREATE TABLE TEST
      2  (
      3     ID          NUMBER
      4    ,NAME        VARCHAR2(30)
      5    ,CITY        VARCHAR2(30)
      6  );
    Table created.
    SQL>INSERT INTO TEST VALUES(1,'Rajesh','Gurgaon');
    1 row created.
    SQL>INSERT INTO TEST VALUES(1,'Rajesh','Gurgaon');
    1 row created.
    SQL>INSERT INTO TEST VALUES(2,'Dinesh','Delhi');
    1 row created.
    SQL>INSERT INTO TEST VALUES(1,'Rajan','Pune');
    1 row created.
    SQL>INSERT INTO TEST VALUES(1,'Rajan','Pune');
    1 row created.
    SQL>COMMIT;
    Commit complete.
    SQL>ALTER TABLE test ADD CONSTRAINTS uk_on_test UNIQUE(ID,NAME,CITY) DEFERRABLE NOVALIDATE ;
    Table altered.
    SQL>ALTER TABLE test
      2  ENABLE NOVALIDATE CONSTRAINT uk_on_test;
    Table altered.
    SQL>INSERT INTO TEST VALUES(1,'Rajesh','Gurgaon');
    INSERT INTO TEST VALUES(1,'Rajesh','Gurgaon')
    ERROR at line 1:
    ORA-00001: unique constraint (AIP.UK_ON_TEST) violatedRegards
    Arun

  • How to supress Zero in NUMC data type which contains some values as Char.

    Hello Friends,
    Some custom fields have been added in table BUT000 ,
    out of which one field has data type as NUMC..
    When i see some of the entries in the that field, it has values like '0000000000000000ENT'.
    I want to supress Leading zeros of that.
    i tried using
    1 ) FM CONVERSION_EXIT_ALPHA_OUTPUT &
              CONVERSION_EXIT_ALPHA_INPUT .
    2 ) Also tried coding  like this:
    data:var1 type ZBU_00LV36AT,           "this field has data type NUMC of length 40
           var2(40) type N.
    var1 ='00000000ENTRY'.
    VAR2 = VAR1.
    SHIFT VAR2 LEFT DELETING LEADING '0'.
    Nothing works ...gives output as blank.
    Is there any solution for it....
    Any valuable asnwer will be rewarded...
    Regards,
    Mayank

    Hi Marcin,
    I have tried i think problem it solved with your solution.
    Let me try for some more cases if it works fine i will get back to forum.
    Regards,
    Mayank

Maybe you are looking for