JSF inputText Field localization

Hi!
I tried to create the same search field as we have it here on the upper right corner and localize it.
<h:inputText id="search" value="#{bundle.search}" onfocus= 'if (this.value=="#{bundle.search}") this.value=""' />But every time on submitting i got following exception:
javax.el.PropertyNotFoundException: /pages/header.xhtml @109,146 value="#{bundle.search}": /pages/header.xhtml @106,58 value="#{bundle.search}": Target Unreachable, identifier 'bundle' resolved to null
     com.sun.facelets.el.TagValueExpression.getType(TagValueExpression.java:62)
     com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getConvertedValue(HtmlBasicInputRenderer.java:81)
     javax.faces.component.UIInput.getConvertedValue(UIInput.java:934)
     javax.faces.component.UIInput.validate(UIInput.java:860)That means the servlet is trying to resolve the value expression "bundle", which is not available. Actually, I even don't want it to do so, because only the value typed by user is necessary.
So I created a custom converter class to fix this problem:
public class EmptyConverter implements Converter
     public Object getAsObject( FacesContext context, UIComponent component, String value )
          return value.toString();
     public String getAsString( FacesContext context, UIComponent component, Object value )
          return value.toString();
}and
<h:inputText id="search" value="#{bundle.search}" converter="EmptyConverter" onfocus= 'if (this.value=="#{bundle.search}") this.value=""' />Also don't forget to declare it in faces-config.xml
So my question:
- is this a jsf bug?
- is it possible to switch off the converter and validation for the particular component?
(immediate="true" only moves the validation to another lifecycle step!)
Thank you,
Artem

Since <loadBundle> loads resouce bundle in as a map, change your code as follows:
<jsfh:output_text value="#{jsfresource['Search.Value']}" />

Similar Messages

  • Spaces in the inputText field

    Hi,
    Iam not sure of how best I can explain the problem I experience on my JSF pages.
    When i try to select a value from the drop down list..it is populating other fields on the page perfectly.
    One of the fields is Zipcode which has a validator on it
    Zip Code:
    <h:inputText id="text5" maxlength="5" size="5" immediate="true"
        value="#{processApplication.ownerZipcode}">
    <f:validator validatorId="zipcodeValidator"/></h:inputText>
    <font color="#FF0000"><h:message for="text5" /></font> When i make any changes and hit save button on the page...(Most of the times) I get a red color msg beside the zipcode field "Zipcode not valid" eventhough that field is blank.
    But, the cursor on that field is in the middle of the field which makes zipcodeValidator trigger becoz it cannot take any spaces.
    when i place the cursor to the front of the field and hit save...everythiing is fine.
    Why does the zipcode inputText field adds those spaces all by itself?
    Any clue?
    Any help is really really appreciated.

    Thanks BalusC!!
    Let me be more clear with this issue.
    I have four inputText fields with required = "#{param['form1:button3'] == 'Issue License'}"When I click on a link...
    These 4 text fields get the data(if any) from the database.
    Now, when I click on the "Issue License" command button , I should check if these 4 fields are not null.
    If any one of them is null, then I get the message "required field is missing" and I fill that field accordingly.
    Now, the problem is....
    When I click on a link...I noticed that the first field added few spaces by itself since the cursor is in the middle of the inputText box. Other 3 fields are normal and blank too i.e., all 4 fields did'nt get any data from DB.
    When I click "Issue License" command button, I get "required field is missing" msg, only for 3 inputText fields but not for the first one since the first one has already few spaces in it and the required attribute thinks it has some value in it.
    Now, how should I handle this situation?
    Do you think
    creating a converter for java.lang.String which converts empty/spacy strings to null would solve the problem?
    This happens in few other pages too.
    Please suggest me the solution.
    Thanks

  • Jsf inputtext and a4j

    Hi all!
    I have a problem with the jsf inputtexts used with the ajax call made by a4j library.
    In a jsf page I've a list of item in a table.
    For each item in the table there are a button 'details' (a4j:commandButton).
    On click on this button appears another part of page (editpanel) in which I put all the info of the item.
    In the 'edit panel' I can edit some fields and then update them clicking on the button 'save'.
    If I click on the details button of another item the editpanel should change showing the details of new item clicked.
    It's all ok I in the editpanel I put the outputText element. But I need to put in the edit panel also inputText element, but the inputElement remain frozen on the first time content and the outputText change.
    Shortly...my question is...how can I update a inputText in a "area" updated after an ajaxCall?
    I'm sorry for my ugly english...:(
    Thanks all....

    When you set the property in the bean, you set it in the "model". However, the page in rendered based on the data from the component tree, but from the "model" in your case.
    You have to create a component binding for text field and change the value using it.
    Sergey : http://jsfTutorials.net

  • Updating data in h:inputText field

    In my <h:inputText> field, first time user enter a number to search, and the number saved in the session, later on from page to page navigation, sometime user can selected another order number , save the number in session and refresh the whole web content, the value in this <h:inputText> field should update the new number from session everytime the web page reloaded, this actually working fine in the <h:outputText> field as following code <h:outputText value="#{MyPageCode.orderNumber}"/> which getting the orderNumber from session,
    but it is not working in the <h:inputText> getting the new number from session, it always keep the first time user entered number there, can someone help me to solve the problem?
    Thanks a lot !
    <h:form styleClass="form">
      <h:outputText  value="Order#: "/>
         <h:inputText  value="#{mySession.orderNo}">  </h:inputText>
              <f:param name="orderNo" value="#mySession.orderNo}">
              </f:param>
    <h:commandLink  style="padding-top:3px;" action="#{myBean.searchAction}">
       <h:outputText  value="Search" >
       </h:outputText>
    </h:commandLink>
    <h:outputText  value="Order number is#: "/>
    <h:outputText value="#{MyPageCode.orderNumber}"/>
    </h:form>

    Here you are, hope I did not lost anything... Thanks!
    faces-config.xml:
    ====================
    <managed-bean>
              <managed-bean-name>mySession</managed-bean-name>
              <managed-bean-class>myManagedSession</managed-bean-class>
              <managed-bean-scope>session</managed-bean-scope>
         </managed-bean>
         <managed-bean>
                   <managed-bean-name>myBean</managed-bean-name>
                   <managed-bean-class>MyManagedBean</managed-bean-class>
                   <managed-bean-scope>request</managed-bean-scope>
         </managed-bean>
         <managed-bean>
                   <managed-bean-name>MyPageCode</managed-bean-name>
                   <managed-bean-class>MyManagedPageCode</managed-bean-class>
                   <managed-bean-scope>request</managed-bean-scope>
         </managed-bean>
         =================================
         public class MySession {
            private Integer orderNo;
                 public Integer getOrderNo() {
                      return orderNo;
                 public void setOrderNo(Integer orderNo) {
                      this.orderNo = orderNo;
                public void setOrderNumber(int on) {
                  // set order number in session
          ===================
           public class MyBean {
         public String searchAction() {
                   Integer orderNo = getMySession().getOrderNo();
                   if(orderNo != null){               
                      int orderNumber = orderNo.intValue();
                      getRequestScope().put("OrderNumber", new Integer(orderNumber));
                      getMySession().setOrderNumber(orderNumber);                    
                   return "page1";
         protected MySession getMySession() {
                   if (mySession == null) {
                        mySession = (MySession) getFacesContext()
                                  .getApplication().createValueBinding("#{mySession}")
                                  .getValue(getFacesContext());
                   return mySession;
    =========
    public class MyPageCode {
        public int  getOrderNumber() {
             // get from session
    }

  • Dynamic inputText fields values.

    Dear all,
    Please suggest solution on following:
    In my ADF/Trinidad project I have one view which is build dynamically by <tr:iteratior/> tag depending on amount of binding elements. Purpose of the page is to read parameter names from database and ask user to provide values for those parameters. Sample code:
    <tr:iterator var="items" first="0" value="#{bindings.parameters.collectionModel}" varStatus="status" id="ip">
         <tr:inputText Label="#{items.bindings.label.inputValue}" binding="#{backing_parameters.it}" id="it"/>
    </iterator>Once user resubmits page I need create pairs of parameter/value in backing bean and use it further in business logic. My challenge is to how actually obtain these values, provided by user if amount of fields (inputText) is only determined during runtime?
    Sorry if solution is too obvious. Please guide me to the correct way.

    I think I succeeded to resolve it:
    Solution:
    1. Create ValueChangeEvent on backing bean and map it to the inputText field
    2. Add <f:attribute/> tag to map inputText field to desirable value
    3. Handle event in backing bean and obtain new values and mapping to the field from ValueChangeEvent object.
    The only issue is if user does not change value of the field, then no event created and backing bean still does not know on existence of inputText field and its value
    <tr:iterator var="items" first="0" value="#{bindings.parameters.collectionModel}" varStatus="status" id="ip" >
         <tr:inputText valueChangeListener="#{backing_parameters.event}" label="#{items.bindings.label.inputValue}" binding="#{backing_parameters.it}" id="it">
              <f:attribute name="paramName" value="#{items.bindings.name.inputValue}"/>
         </inputText>
    </iterator>
    public void event(ValueChangeEvent actionEvent) {
        actionEvent.getComponent().getAttributes().get("paramName");
        actionEvent.getNewValue();
    }Thank you.

  • Secret inputText field on showOneTab is cleared when tab changes

    I have a secret inputTextField on a tab. If a change to another tab and then change back again the password is cleared.
    Is there a work around for this?
    Thanks
    Martin

    Hi frank,
    No, I don't do any extra submits.
    I have a simple af:showOneTab with a secret inputText field on tab 1. The secret textfield is bound to a property on a backing bean which contains the current value of a password. When I click on tab 2, than back to tab 1 the secret textfield has been cleared. I would add that there are non-secret fields on each tab which are not cleared.
    Martin

  • How to keep the focus on the inputtext field.

    Hi,
    I'm using jdev 11.1.2.0
    I have two inputtext fields.
    when i tabout from firstinputtextfield , i'm calling a javascript to set focus on to the second textinput field.
    this is working fine.
    Second textfield has one server listner onblur event.
    When i add value change listener on the firstinputext field, after tabout from the first field , focus is going to set to next field and calling the serverlistener of the second field.
    how to make the not to call the serverlistner function of the second field when i tabout from the first field?(serverlistener is called only when i tabout from the second field on onblur event)(Thi is happening in ie8)
    Any suggestion would be appreciated.
    Thank you.

    If you have a value change listener it will send up ajax call when you tab out which may be have a bad interaction with your client listener. Instead of using a client listener you could try adding the javascript call to response from the value change listener. In your value change listener add a call to the javascript method that sets the focus
    public void addScriptToResponse(String script){
    ExtendedRenderKitService erkService = Service.getService(getFacesContext().getRenderKit(), ExtendedRenderKitService.class);
    erkService.addScript(getFacesContext(),script);
    }

  • SelectOneChoice to populate an InputText field

    I am using JDeveloper 10.1.3 and ADF, and I would like to have a DataBound SelectOneChoice dropdown list populate the selected value into another InputText field in the form. The destination is just a plain InputText field.
    From what I can see, the result of the selection HAS to go into some Base Data Source field, but that's not what I want to do. Is this not possible or is there another way to allow someone to populate a field from a dropdown list.
    Thanks.
    Andy

    Are you using ADF BC in the back end? Would it help if you added a transient attribute to the VO (ie one which is non database) and then you could simply return the value from the list into that (and so use the existing binding dialog?)
    Alternatively check out this.
    http://groundside.com/blog/GrantRonald?title=conditional_rendering_of_jsf_fields_depe&more=1&c=1&tb=1&pb=1
    You just need to do the first part of this example...i.e. create a proxy bind variable and return the value from the drop down into the bind var and then display this bind var in a text field on the page.
    Regards
    Grant Ronald

  • How do you clear an InputText field with a button click

    I am trying to create a calculator and I want to be able to use a "Clear" button that will reset all the values entered in several InputText fields and the total which is a label.     I can update and clear a label using the UpdateContext
    function, but this isn't working for an InputText field.   Can someone provide an example on how to clear one InputText field?

    Hello,
    To do this you need to do the following
    Add an "Input Text", select the inputText and click Express view (bottom right).
    Set the default value to
    textboxvalue
    without any quotes
    On the behaviour / OnVisible of screen you put the inputText on set for example the following
    UpdateContext({textboxvalue: "Enter text here"})
    You can now add several buttons on the screen that do something
    UpdateContext({textboxvalue: ""})
    or
    UpdateContext({textboxvalue: "Enter Text here"})
    Or you could chain it with another OnSelect that is going on on the screen and reset your textbox. You can then also add the value the user has entered in a collection too (see bottom example)
    Navigate(Screen2, ScreenTransition!Fade);UpdateContext({textboxvalue: "Enter Text here"})
    Collect(inputcollection,{userinput: InputText1!Text});Navigate(Screen2, ScreenTransition!Fade);UpdateContext({textboxvalue: "Enter Text here"})
    I believe this should point you in the right direction
    Regards
    StonyArc

  • How Can I hide InputText Field?

    Hi everybody..
    How can I hide a InputText Field from a af:table?
    I need to pass a value to a specific attribute. but I´d like to hide from user...
    is that possible?
    thanks again.

    The "rendered" attribute.
    <af:inputText rendered="true" />
    <af:inputText rendered="false" />
    I believe it supports EL.

  • JSF inputText takes apostrophe (single quote) as end of string

    Hi,
    I run into a problem with JSF when apostrophe(single quote) is in input text:
    <h:inputText id="input1" styleClass="field" size="20" maxlength="20" value="#{bean.property1}" />
    When user inputs string contains apostrophe (single quote), for example "John's task", the bean only gets "John". The text after the apostrophy is gone. It seems that the inputText takes apostrohe as end of the string.
    I also test with escaple sequence, for example, input is "John\' task", the result in bean is still "John"
    input is "John\\\' task", the result in bean is "John
    It doesn't have problem with other special characters, such as "<">", "@" , double quote etc.
    Finally, I fix the problem by replacing apostrohy with "& # 0 3 9".
    I just wonder if anyone has similar prolbem and wehether this is some bug in certain version of JSTL or some configuration issue ( for example, some definittion for end of the string in some config file, etc).
    Your insight is appreciated.
    Thanks

    Without the actual code we can't be of any meaning for you. Create a small reprocudeable test case and post the actual code here. For example:
    JSF<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <f:view>
        <html>
            <head>
                <title>test</title>
            </head>
            <body>
                <h:form>
                    <h:inputText value="#{myBean.value}" />
                    <h:commandButton value="submit" action="#{myBean.action}" />
                    <h:outputText value="#{myBean.value}" />
                </h:form>
            </body>
        </html>
    </f:view>MyBeanpackage mypackage;
    public class MyBean {
        private String value;
        public void action() {
            System.out.println(value);
        public String getValue() {
            return value;
        public void setValue(String value) {
            this.value = value;
    }faces-config:<faces-config>
        <managed-bean>
            <managed-bean-name>myBean</managed-bean-name>
            <managed-bean-class>mypackage.MyBean</managed-bean-class>
            <managed-bean-scope>request</managed-bean-scope>
        </managed-bean>
    </faces-config>Which works fine by the way.

  • Problem mapping inputText field to a variable in a data control

    I have encountered the following problem. Please help. Any feedback is appreciated.
    I have a page that contains first name, last name, address, city, state zip and country input text fields and a submit button. When the submit button is clicked, user entered information will be commited to database. This is easily achieved by using a managed bean.
    Now I would like to achieve the same functionality by using data control. The reason I want to use data control is to avoid putting the controls (first name, last name, address, city, state zip and country) in the managed bean. I was hoping that they can be directly mapped to the data control variables. The data control is created from a Java object which contains attributes of first name, last name, address, city, state zip and country. The data control is dragged and dropped to a jsff page and the jsff looks like the following:
    <af:inputText label="First Name"
    value="#{bindings.firstName.inputValue}"
    required="true"
    maximumLength="25" autoSubmit="true"
    id="it10">
    </af:inputText>
    When I run the page, I can see the label First name but the input box was not shown. So I removed: value="#{bindings.firstName.inputValue}" and the input box appears.
    Why did that happen? Can I directly map a data control attribute to an input text field?
    Thank,
    Cecilia

    Thanks for the response, Shay. Really appreciate it.
    I tried your first solution - modified the property IsUpdateable to Updateable. However the input text box is still not appearing.
    My java class is just a simple Java class. In the class all I have is just a get method for a domain model object.
    In the jsff, if I assigned a value to the value attribute (value="Jane"), the input text box would appear as updateable.
    Any idea?

  • BUG - JSF InputText boxes not populating properly

    Okay,
    Here's the situation:
    I have an edit page (JSF Web) that allows the user to pick an item to edit from a SelectOneMenu tag. When they pick the item the page rerenders and shows the object associated with the selected item allowing the user to edit the object in various InputText controls.
    First of all the ValueChangeListener event doesn't work for the SelectOneMenu tag - the event is not recognized in the backing bean (with or without immediate set, the event code is never accessed.) - and so I had to tie the change to the pressing of a command button.
    Upon pressing the command button, in the action event, I find the object from the selected item. Now I want to set the input text boxes in the screen to the various values of the object. There are two ways to do this. I either set the value property of the bound (using the binding property) backing bean to the objects property - the code looks like this:
    <h:inputText binding="#{EditCalendarBean.name}"
    value="#{EditCalendarBean.name.value}"/>
    This results in a fatal error that halts the OC4J.
    Alternatively; I added various properties to the backing bean one for each property of the object and bound the object's properties to these and then bound the user interface's value properties to the bean properties. For example, imagine a user interface control InputText tag called "name" has it's value property bound to a property on the bean called Name which returns String. This configuration runs but the InputText control when the page is re-rendered (after the submit), is empty even though I've set the value property. However, if I add an OutputText control to the page and bind it's value property to the same String property of the bean, the outputText control correctly shows the value of the object.
    The code looks like this:
    <!-- code in the page -->
    <h:inputText id="name" binding="#{EditCalendarBean.name}"
    value="#{EditCalendarBean.nameValue}"/>
    // Code in the Backing bean:
    // Find the Bean from the submitted id from the SelectMenuTag.
    CalendarData data = manager.getCalendarById(calendarID) ;
    // Set value of the UITextInput components on the page.
    this.getName().setValue(data.getName());
    this.getDescription().setValue(this.getDescription());
    // This results in a fatal error that halts the OC4J
    // Method 2: declare two String properties on the bean and set them
    // Then, in the page use the Value property of the InputText control.
    // This runs but doesn't populate the controls. It does populate them if
    // the contols are OutputText controls though!!!
    this.setNameValue(data.getName());
    this.setDescriptionValue(data.getDescription());
    Best regards,
    Nigel

    Yes - this really is a bug. Any changes to make to the selectItems tag through the properties dialog rewrites the tag source code to seperate the selectOne tag and the selectItems tag. For example, before you use the dialog, you tag code could look like this:
    <h:selectOneMenu binding="#{backing_showFactory.selectOneMenu1}"
    id="selectOneMenu1">
    <f:selectItems value="#{backing_showFactory.allFactories}"
    binding="#{backing_showFactory.selectItems2}"
    id="selectItems2"/>
    </h:selectOneMenu>
    After the use of the dialog the code will be rewritten as:
    <h:selectOneMenu binding="#{backing_showFactory.selectOneMenu1}"
    id="selectOneMenu1"/>
    <f:selectItems value="#{backing_showFactory.allFactories}"
    binding="#{backing_showFactory.selectItems2}"
    id="selectItems2"/>
    Notice, the tags are now seperated instead of the selectItems tag being encased in the selectOneMenu tag.

  • It possible using javascript to change the value of another jsf text field?

    In my case, I have an input text field and would like to copy it's value on the onchange() event into another text field. Using the destination text field's Id and assigning some content with it's .value property

    Woodstock apparently renders some Javascript/DOM with some homegrown widget framework which on its turn renders the HTML DOM tree instead of plain vanilla HTML. Correct me if I'm wrong, to confirm this, just view the generated HTML source of the page.
    After some Googling I found out that you need getProps() and setProps() to get and set element attributes respectively.
    [http://google.com/search?q=webuijsf+domnode+site:sun.com].
    If you stucks with this, I recommend you to post this question at a forum or mailinglist devoted to Woodstock, e.g at their own homepage at dev.java.net or the Netbeans forum at nabble.com. You're here at a Sun JSF forum, not at a Woodstock forum.

  • Problem in inputText field

    I am creating an application for changing profile of a customer. I want the textbox should show the value extracted from database as well as it should update the value if it is changed.
    My problem is, if we want to show a value in text box syntax is
    <h:inputText id="name" value="xyz"/>and if we want to attach the field to a bean property then it is
    <h:inputText id="name" value="#{loginBean.name}"/>now how to use both.

    Hi BalusC
    I am explaining my problem briefly. I have the information about the customer in my database. Now i want to provide a form where user can able to change the profile.
    The text box should display the data extracted from the database and if any modification done then it should update.
    The combobox should show the proper value when the change profile page should open.

Maybe you are looking for