Accessing resource bundle in h:inputText

Hi,
I am trying to dynamically populate the label attribute of <h:inputText tag;
<h:inputText id="fullNameField" value="#{newUserFormBean.fullName}"
                              label="#{resourceBundle.fullName}">
<f:validateLength minimum="3" maximum="64"/>
</h:inputText>When I validate this field i want to populate the error message with the value of label attribute from resource bundle. But it isn't showing up anything, but if i hard code the value of the label field, it displays that value. How do i resolve it?
Thanks.
Edited by: Mujju101 on Aug 29, 2010 10:26 PM
Edited by: Mujju101 on Aug 29, 2010 10:26 PM

Yes it does show up when i use
<h:outputLabel value="#{resourceBundle.label_fullName}:" styleClass="label" />or either:
<h:outputText value="#{resourceBundle.label_fullName}:" styleClass="label" /> It errs only when used in <h:inputTextEdited by: Mujju101 on Aug 30, 2010 1:17 AM
Edited by: Mujju101 on Aug 30, 2010 1:18 AM

Similar Messages

  • Access Resource Bundle Data Programmatically

    JDeveloper 11g 11.1.1.2.0
    We've encountered a scenario where we also want to set messages being thrown from our java objects (Impl classes or Beans) to use messages from the resource bundle as data to be thrown.
    Is there a utility or a class that can easily give us access to the xliff document which will allow us to just get by id?

    You can access the resource bundle in the Model as shown below:
    import java.util.Locale;
    import java.util.ResourceBundle;
       ResourceBundle params =
           ResourceBundle.getBundle("com.bundle.location", Locale.getDefault());
       String value = params.getString("someKey");
    ...

  • Accessing resource bundles through javascript

    Is there a way that I can localize the text in the following javascript snippet?
    function confirmDelete(event)
    if (confirm('*Are you sure you want to delete this record?*'))
    event.cancel();
    var source = event.getSource();
    AdfCustomEvent.queue(source, "deleteGuestMessage", {}, false);
    return true;
    else
    return false;
    Thanks in advance!

    Well, I figured it out myself.
    One way is to pass in a property of the translatable string through the <af:clientAttribute> tag.
    Once you pass that in, you can get the property and use is, e.g.
    var deleteMessage = event.getSource().getProperty("deleteMessage");
    if (confirm(deleteMessage))
    Happy Coding!

  • How to use a resource bundle in viewcontroller project

    How can I create a resource bundle for a viewcontroller project ? Is there any way to add entries to it other than adding manually editing the property file ? so that all the key generated will be unique? How to access a message in the resource bundle in my backing bean so that I can display it in my screen ?
    Thanks
    Suneesh

    Suneesh Raman wrote:
    How to access a message in the resource bundle in my backing bean so that I can display it in my screen ?Take a look at this: http://adfcodebits.blogspot.com/2010/04/bit-5-accessing-resource-bundle-from.html

  • How to use resource bundles?

    I have a requirement to translate the test that appears on the custom buttons of my portal application. I know resource bundles are part of .properties file that are delivered in Classes floder. But i am not sure how should i make use of this in translating the button text. It would be grate if someone knows it. I will be  very helpfull.
    Regards,
    Ameya

    Hi Ameya,
    [This link|http://help.sap.com/saphelp_nw04/helpdata/en/74/641640b7b6dd5fe10000000a155106/frameset.htm] will provide you information on how to implement Portal Content Translation.
    [This link|http://help.sap.com/saphelp_nw04/helpdata/en/62/8b1d40bb37e569e10000000a155106/frameset.htm] will explain how to create and access Resource Bundles (read the entire chapter).
    Hope it helps,
    Roy
    Edited by: Roy Cohen on Nov 26, 2008 3:21 PM

  • Message catalogs vs. straight resource bundles

    Hello,
    I'm just starting to investigate someof WebLogic's internationalization features,
    and I'm trying to decide what the benefits would be for using the i18n features
    instead of straight Java resource bundles.
    Basically, I'm looking for a way to externalize all of our error messages, exceptions,
    and GUI elements (like text labels). This will be a Struts application, using
    Struts validation. Internationalization itself is a goal, but it is not the driving
    factor for externalizing all of our message strings.
    I'm seeing to benefits to using the WebLogic i18n functionality. First, all of
    the "resource strings" are specified in an XML document that can be validated
    and is possibly easier to maintain. Second, accessing these strings becomes a
    call to individual methods of a automatically generated TextFormatter class, thereby
    freeing client code from having to directly access resource bundles.
    Are there any other benefits to using this? I'm just wondering if these benefits
    are really worth it, or if it's overkill.
    Thanks for the help.
    - Jeff

    http://forum.java.sun.com/thread.jspa?threadID=677420&messageID=9483204
    go through this link...

  • ADF FACES: af:messages does'nt display label with resource bundles

    Hi,
    There is a problem with the af:messages component and error messages containing labels (such as Value is Required error message for required fields).
    If I have an af:inputText with it's label property refering to a resource bundle loaded using the f:loadBundle action, when the Value is Required message is displayed, I get "" for the field name.
    If I replace the label property with a constant value or with an expression refering to a managed bean property, then the label is properly displayed in the error message.
    I suspect this has to do as to when the action of getting the label is done. Maybe the bundle is not availlable at that time. Anyway, this is a bummer as it mean that we cannot use the f:loadBundle action to load resource bundles.
    This happen with AE11. I have not tested this with EA12.

    Thank's!
    I'll try EA12 when I have the time.
    I also found that in our JSPs, we've put the f:loadBundle ouside of the f:view tag. I'll fix that in our codebase.
    While researching a fix, I found out that using a managed bean (which implement Map interface) to load the bundle based on the name refered in the expression language is a lot more intuitive and allow for an easier management of the different resource bundle than the f:loadBundle tag.
    Basically, our EL expression are now #{bundles.bundleName.property} we replace any "_" in bundleName with "." and then lookup this name as a ResourceBundle with the locale of the view. We keep the managed bean in the request scope it remember each bundle it loaded.
    We could have done it with a custom VariableResolver. Maybe a future release of the JSF spec could provide a standard variable name that would implement the same behaviour. This way, one does not have to load each bundles before hand and only the bundles accessed by the JSP will be loaded.

  • File not found, Missing resource bundle

    Hi
    I have a problem in accessing files (XML and Resource bundles) in Java projects. I used to access these files in WD Java. The same piece of code does not work here.
    e.g. When I create a new file object by providing the path name I get a file not found exception. The file exists in my package and I call it this way:
    File f = new File("file.txt"); then in an input stream but it doesnt work. However in a J2EE project the same code works.
    Similarly the resouce bundle never seems to work even if I give the fully classified class name for the property file. I can access property files in WD Java with ease. I understand that the root path changes and hence the problem. How should I solve it? Is there an elegant way which makes it work in all cases? Please throw some light on the root path for these projects. Thank you.
    regards
    LNV
    Edited by: vln on Jan 16, 2008 9:34 AM

    You should be using
    <b>this.getClass().getResourceAsStream(filePath)</b>
    which will return you an InputStream.
    Check the JDK documentation for the respective methods in java.lang.Class and java.lang.ClassLoader.
    HTH!
    \-- Vladimir

  • How to link the resource bundle in JSF implemented in  eclipse?

    Kindly help me out

    This is how I called the resource bundle in JSF
    <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
    <%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
    <%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Insert title here</title>
    </head>
    <body>
    <f:view>
    <f:loadBundle basename="constantsUIProp" var="prop"/>
    <h:form>
    <h:inputText maxlength="#{prop.AREA_CODE_MAX}"></h:inputText>
    </h:form>
    </f:view>
    </body>
    </html>
    when i tend to build, it shows an error like+ Resource bundle cannot be found on the classpath+
    I have saved the resource bundle in WebContent/Web-Inf/classes/constantsUIProp

  • Problem with resource bundle messages written inside script of jsf included

    Hi,
    I have a main jsf page with the name Details.jsp.In this page I included Contacts jsf page.I am using resouce bundle for my application.I written all the output text tags with this resouce bundle keys.And I written the Details main page javascript alerts with this resource bundle correctly.But the problem is,I am having script alrts in my included jsf apge i.e. in Contacts page.When I write the script alerts with the resource bundle keys,it is not displaying properly.
    ---------------------------------------------------------------------Details.jsp--------------------------------------
    <f:loadBundle basename="Details_en" var="msg"/>
    <f:view>
    <head>
    <script>
    function saveFn()
    var d=document.getElementById('dform:dinputtext').value;
    if(d=='')
    alert('<h:outputText value="#{msg.requiredValidationMsgkey}"/>');
    return false;
    if(emailValidation()==false)
    return false;
    </script>
    </head>
    <body>
    <h:form id="dform">
    <h:outputText value="#{msg.nameHeader}"/>
    <h:inputText value="#{Bean.name}" id="dinputtext"/>
    <jsp:include page="/Contacts.jsp"/>
    <h:commandButton value="Save" onclick="if(saveFn()==false) return false;" action="#{Bean.saveAction}"/>
    </h:form>
    </body>
    </f:view>
    -------------------------------------------------Contacts.jsp----------------------------------------
    <script>
    function emailValidation()
    var em= document.getElementById('dform:cSubView:cemailtext').value;
    if(em=='')
    alert('<h:outputText value="#{msg.emailValidationMsgKey}"/>');
    return false;
    </script>
    <f:subview id="cSubView">
    <h:inputText value="#{CBean.email}" id="cemailtext" />
    </f:subview>
    The alert message in SaveFn is getting appeared coorectly.But in the function emailValidation is not geting dispalyed correctly.It is appearing as normat output text in the page,but not as an alert.

    Thanks for the reply.
    But I want to do some validations using javascript not only the required validation.
    In my application 5 text fields and one command button are there .Depending upon combination of 2 or 3 text field values, I have to get the values when I pressed command button.
    If I use the h:messages for validators,the conversion error is occurring when the text field takes wrong data.So it is going to give incorrect results when I press the command button.Thats why I am using javascript.
    When user enters wrong data,I want to do validation using javascript and I want to display the alert message using resource bundle.

  • Error in Loading Resource Bundle in JSP

    Hi
    I have one Resource Bundle which working well in my JSP page
    i declared as below
    <f:loadBundle basename="com.ApplicationLabels" var="lblbundle"/>
    Ok then i want to add another new resource bundle and i put it below the first loadBundle tag
    <f:loadBundle basename="com.newLabels" var="newbundle"/>
    But when i access my JSP page it keeps giving me
    Exception Details: javax.faces.el.PropertyNotFoundException
    Error testing property 'test' in bean of type null
    Possible Source of Error:
    Class Name: com.sun.faces.el.PropertyResolverImpl
    File Name: PropertyResolverImpl.java
    Method Name: getType
    Line Number: 342
    What are the things i need to configure after i creatting properties file for my Application Messages in JSP page
    any idea about this exception?
    Thanks.

    Hi Voodi,
    in the record i have many columns that refered to date, i have: Valid-from, Valid-To H, created on, Valid From, Valid To- i don't know where is the specified column to check the required format, in PSA in the data package 19 i have 13755 Records posted and i have checked many records to control these columns but i don't find something that demonstrate me a difference between the format, i don't know why the error signalated is only 6701...but you think is only a problem of format it's not not somthing that i have to signalated to the person who works on R/3 if there is something to correct in the datasource?
    Thanks
    Bilal

  • 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.

  • 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.

  • Java Property Resource Bundle

    I have an XmlError but the JRC engine cannot find a java resource bundle properties file for that key. I have deployed jrc into jboss. Where can I find the file and where is the best location for it?
    thanks
    Bruce

    Hi CaptainMorgan08,
    Thanks for pointing me in that direction. As I understand that is a complete documentation of the class, but I was unable to find there this "key secutiry.ex" error message.
    The applet runs fine when I launch it on my desktop XP, but when I upload it to my Linux server, and access it over the net than it throws this error...
    It seems like this is not a common error...

  • Locale Resource Bundle Best Practice

    Hi
    I have a Flex application that loads it's locale resource bundle from a service.
    So when the httpservice loads the bundle it populates an instance of a class "I18NBundle" that contains all the bundle properties. For instance you could do:
    i18nBundle.hello_message and it would return "Hello"
    I'm currently using Cairngorm for this project so this i18nBundle instance it's on the model locator.
    What I'm seeing and that I don't like is that for a component be able to get the bundle it must access to the model locator and then to the i18nBundle.
    Instead of that what I would like is that each component doesn't rely on this for getting the bundle.
    I guess I could create a "bundle" property on each component class and then pass it the reference to the bundle when it is instanciated. It seems it could be messy and a difficult task to initialize this property in some cases for instance on a datagrid cell renderer.
    Other could be transforming the I18NBundle class into a singleton and then when the service response it's recieved the singleton it's initialized. Since all application components should/must access the same locale bundle I guess this could be a better option.
    What do you think about this?
    Do you think there is some a better way to achieve this with Flex?
    Any opinion or recommendation would be appreciatted.
    (I don't wish to use the Adobe Flex proposal of having the properties file on the Flex project and the compiling them into swf.)
    thanks in advance.
    Polaco.
    ps: If you think I haven't expressed myself correctly please let me know and I will rewrite it.

    I have managed to extend IResourceBundle and added it to ResourceManager.
    The only problem now is that my bundle does not represent a language and it doesn't need a name either.
    Since the localization part is done on the webapplication and then the apporpiate bundle returned in the request's response.
    So it's locale attribute value is "".
    And it's name is "".
    I can display a property correctly if I use the following code:
    (resourceManager.getResourceBundle('','')).content.helloMessage
    but I doesn't work if I try to retrieve it like:
    resourceManager.getString("", "helloMessage");
    any ideas ?
    thanks

Maybe you are looking for

  • EMac - Modem problem ?

    I am using dial-up internet access with the Emac internal modem....when my modem is plugged in, and I am NOT connected to the internet, my home phone cannot receive incoming calls. This happens even when the eMac is switched off. I have tried connect

  • How to use WEB ADI in R12 project accounting- Need urget

    Hi Friends, How to use WEB ADI in R12 for project accounting, right now iam working in a client place, i need to show demo on WEB ADI functionality in project accounting. Iam trying in different ways, it is showing error msgs, if any body have WEB AD

  • Download Z*Objects

    Hello All, Is there any standard report in SAP that downloads all the Z Custom objects/reports along with the Titles of these objects or the method of going to TRDIRT and D010SINF to get the Zobject name, title and the Program Type. Do let me know th

  • Does Z97 XPOWER AC support windows

    I am being very serious when I ask this question because I need to know if I have to rma this board or not. The reason I ask is because 1) all USB ports recognized/usable in BIOS 2) all USB ports recognized/usable in Linux 3) no USB ports recognized/

  • Host header-value matching where a port is used.

    Hi all, Would anyone be able to advise on the match value where the host header includes a port, e.g. www.mysite.com:9080. My question here goes to the collon preceding the port. Can this be done? If so, how? If not, what is other option to match on,