Getting a value of an input text component in backing bean

I have created an input text component on a page where I will be entering a number, setting Autosubmit feature as true. ValueChangeListener property is set as #{test.displayTable} where displayTable is a method defined in test managed bean.
Now I know to fetch the value entered in input text component by creating a RichInputText variable in Advanced property.
But in case the Advanced property is blank, then how will I be able to retrieve the value of it? This is the code. I am not able to get the value entered in the component. I can't even find any getvalue method for it.
FacesContext facesContext = FacesContext.getCurrentInstance();
UIViewRoot root = facesContext.getViewRoot();
RichInputText inputText = (RichInputText) root.findComponent("it1");  // it1 is the id of the input text component
System.out.println("inputText: "+inputText);On using sop statement, this is the output which is getting generated, while I had entered 90.
inputText: RichInputText[UIXEditableFacesBeanImpl, id=it1]

One more thing. Once the VO is getting refreshed, I am able to display an inline message saying that 'Table refreshed Successfully!' (refer the code)
But in case if the user doesn't enter anything, and press TAB button, I want to display an error message exactly besides the input text component, saying that 'Please Enter an Integer.' According to my understanding, if the user enters a null value then while casting string to Integer, it will throw an exception, so I will be writing the code in the catch part. Any suggestions?
public void displayTable(ValueChangeEvent valueChangeEvent) {
        BindingContext bctx = BindingContext.getCurrent();
        BindingContainer bindings = bctx.getCurrentBindingsEntry();
        OperationBinding method = (OperationBinding)bindings.get("displayEmployeeTable");
        try {
            Integer getValue = Integer.valueOf(valueChangeEvent.getNewValue().toString());
            System.out.println("getValue: " + getValue);
            method.getParamsMap().put("deptId", getValue);
        } catch (Exception e) {
        method.execute();
        FacesMessage message = new FacesMessage("Table refreshed Successfully!");
        message.setSeverity(FacesMessage.SEVERITY_INFO);
        FacesContext fc = FacesContext.getCurrentInstance();
        fc.addMessage(null, message);
    }Edited by: Sonull on Jan 12, 2013 3:56 PM

Similar Messages

  • How to get the value of an input text in a table

    all,
    i have an adf table component on my jsf page and i added an input text component to one of the table columns. how do i access the value of that input text in my backing bean? normally, i would just do a getValue(), but because the input text is in the table i'm assuming it has to be treated as an array somehow.
    any help would be appreciated,
    paul
    btw. jdev 10.1.3

    Frank,
    I found a solution to fetching the column values. I created a transient attribute on my view object and bound my column to the transient attribute. Then I used this post from Duncan Mills
    http://groundside.com/blog/DuncanMills.php?title=adf_validation_context_in_a_jsf_table&more=1&c=1&tb=1&pb=1
    to get to the data by looping through the table rows.
    However, I'd still like to use the value from this transient attribute in logic to populate some other columns in the table. I
    for example, here's the content of what's submitted:
    name phone transient
    ==== ===== =======
    paul null 555
    mary null 444
    In my backing bean I'd like to get the rows from the table and read the value of the transient attribute, pass it through a function, and set the value of the column phone to some value for each row. Then have that processed to update the db. Is this possible?
    Thanks,
    Paul

  • How to get a value for Select One Choice in the backing bean

    Friends,
    Does any one have any idea, how to get the value of a selected item value from the Select One Choice component in the backing bean iin valueChangeListener method. Right now I am always getting the sequence of the selected item, instead the actual selected value. I tried using 'ValuePassTrhough=true' also.. but didn't help
    Below is the my code snippet
    <af:selectOneChoice value="#{bindings.country.inputValue}"
    required="#{bindings.country.hints.mandatory}"
    shortDesc="#{bindings.country.hints.tooltip}"
    id="soc1" autoSubmit="true" valuePassThru="true"
    valueChangeListener="#{pageFlowScope.Bean.onValueChange
    <f:selectItems value="#{bindings.country.items}" id="si2"/>
    </af:selectOneChoice>
    Thanks in advance.

    check my other post at Re: Pass data from a variable to another page

  • Get selected value from a select one choice in the bean

    I'm trying to do with the SelectOneChoice valueChangeListener and this is the code of my method, I'm using jdeveloper11g if alguin can help as I need the value you selected in the bean
    public void cambioCombo(ValueChangeEvent valueChangeEvent) {
    CoreSelectOneChoice csoc = (CoreSelectOneChoice) valueChangeEvent.getSource();
    List childList = csoc.getChildren();
    for (int i = 0; i < childList.size(); i++) {
    if (childList.get(i) instanceof CoreSelectItem){
    CoreSelectItem csi = (CoreSelectItem) childList.get(i);
    if (((String)csi.getValue()).equals((String) valueChangeEvent.getNewValue()) ){
    System.out.println("------------>"+csi.getLabel());
    I get the following error when running the application and selecting in my select one choice
    oracle.adf.view.rich.component.rich.input.RichSelectOneChoice cannot be cast to org.apache.myfaces.trinidad.component.core.input.CoreSelectOneChoice

    This is an example of some code that i wrote.
    public void changeDesc(ValueChangeEvent valueChangeEvent) {
    // Add event code here...
    System.out.println("value "+ valueChangeEvent.getNewValue().toString());
    //System.out.println("old value "+ valueChangeEvent.getOldValue().toString());
    if (valueChangeEvent.getNewValue().toString().equals("Area Uno")){
    this.descripcion.setValue("RR.HH");
    } else {
    this.descripcion.setValue("Finanzas");
    AdfFacesContext.getCurrentInstance().addPartialTarget(this.descripcion);
    For get the Value select in the "SelectOneChice" component i use this: valueChangeEvent.getNewValue().toString()
    cheers

  • How can I receive the value of a selected item in the backing bean

    I have a table in a jspx file.
    When I go to the detail page I want to do something with the value of the currentrow.
    I want do a calculaction of the value of ClbId.
    How can I receive the value of the selected ClbId in my backing bean
    <af:table value="#{bindings.Searchteamlist.collectionModel}"
    var="row" rows="#{bindings.Searchteamlist.rangeSize}"
    first="#{bindings.Searchteamlist.rangeStart}"
    emptyText="#{bindings.Searchteamlist.viewable ? 'No rows yet.' : 'Access Denied.'}"
    selectionState="#{bindings.Searchteamlist.collectionModel.selectedRow}"
    selectionListener="#{bindings.Searchteamlist.collectionModel.makeCurrent}"
    rendered="#{backing_FirstFlag_Club_Club.searchFirstTimeClub_Club_AdresAndereClubs == false}">
    <af:column sortProperty="Matricule" sortable="true"
    headerText="#{bindings.Searchteamlist.labels.Matricule}">
    <af:outputText value="#{row.Matricule}"/>
    </af:column>
    <af:column sortProperty="ClbId" sortable="true"
    headerText="#{bindings.Searchteamlist.labels.ClbId}">
    <af:outputText value="#{row.ClbId}">
    <f:convertNumber groupingUsed="false"
    pattern="#{bindings.Searchteamlist.formats.ClbId}"/>
    </af:outputText>
    </af:column>
    <af:column sortProperty="Nom" sortable="true"
    headerText="#{bindings.Searchteamlist.labels.Nom}">
    <af:outputText value="#{row.Nom}"/>
    </af:column>
    <f:facet name="selection">
    <af:tableSelectOne text="Select and">
    <af:commandButton text="Submit"
    action="club_AdresAndereClubsDetail">
    <af:setActionListener from="#{row}"
    to="#{processScope.row}"/>
    </af:commandButton>
    </af:tableSelectOne>
    </f:facet>
    </af:table>

    hi tde
    Using an Expression Language helper class like this one from Steve Muench ...
    http://radio.weblogs.com/0118231/stories/2006/12/18/sourceForMyFavoriteElHelperClass.html
    ... you could write something like this in your backing bean:
    Integer vClbId = (Integer)EL.get("#{row.ClbId}");(Make sure to cast it to the correct type.)
    success
    Jan Vervecken

  • How to get values of all input text of a form?

    Hi,
    I would like to know how to get all input text value of a form?
    I try this:
            List values = new ArrayList(); 
            values = getBindings().getAttributeBindings(); 
            for (Iterator iterator = values.iterator(); iterator.hasNext();) {
                Object o = iterator.next();
                if (o != null) { 
                    if (o instanceof FacesCtrlAttrsBinding) { 
                        System.out.println("Trace iterator=" + ((FacesCtrlAttrsBinding)o).getName());
    src
    In my jspx, I use panelTabbed component which is in af:form
    With this code, I get all bindings name.
    So I change the [structure |http://h.imagehost.org/0922/jdev.png] putting af:form in each item of my af:panelTabbed without succes.
    The code trace all bindings again, and I just want to get the input text of the form (like *$_POST*, or *$_GET* in php)
    How to do that?
    Thanks for your help.

    Hi,
    I try this:
    private UIComponent getUIComponent(String name) { 
          FacesContext facesCtx = FacesContext.getCurrentInstance(); 
          return facesCtx.getViewRoot().findComponent(name) ; 
    src
    I post the structure again.
    I try:
    // f1 id of af:form
    UIComponent test =  getUIComponent("f1");
    test is not null
    // pfl1 id of af:panelFormLayout
    UIComponent test =  getUIComponent("pfl1");
    but here test is null
    I try
    // f1 id of af:form
    // pt1 id of af:pageTemplate
    // pt2 id of af:panelTabbed
    // sdi1 id of af:showDetailItem
    // ps1 id of af:panelSplitter
    // pgl32 id of af:panelGroupLayout
    // pfl1 id of af:panelFormLayout
    UIComponent test =  getUIComponent("f1:pt1:pt2:sdi1:ps1:pgl32:pfl1");but I have this:
    Error 500--Internal Server Error
    javax.servlet.ServletException: java.lang.IllegalArgumentException: f1So I add
    private static final char SEPARATOR_CHAR = ':';But I have the same error.
    getUIComponent returns null with pt2,sdi1, ps1, pgl32, pfl1 and not null with f1, pt1.
    I don't know why...
    How can I get children (af:inputText) of pfl1 ?
    Thanks

  • Issue using JS to change the value of an output text component dynamically

    I am developing an application and I need to change the output text component value at run time when the mouse moves over a field. I am using javascript and then using UIComponent.setproperty to change the value.
    I am not able to do this and am getting nothing.
    Kindly let me know what am I doing wrong
    I am using ADF 11g (10th November release).
    Regards,
    Deepak

    Hi i'm doing the same thing with an input text
    here is my code
    jspx:
    <af:inputText value="#{bindings.MiddleName.inputValue}"
    label="#{bindings.MiddleName.hints.label}"
    required="#{bindings.MiddleName.hints.mandatory}"
    columns="#{bindings.MiddleName.hints.displayWidth}"
    maximumLength="#{bindings.MiddleName.hints.precision}"
    shortDesc="#{bindings.MiddleName.hints.tooltip}"
    id="it4" autoSubmit="true">
    <f:validator binding="#{bindings.MiddleName.validator}"/>
    <af:clientListener type="valueChange" method="mo_UpperCase"/>
    </af:inputText>
    js:
    function mo_UpperCase(event){
    var inputField = event.getSource();
    if (event.getNewValue().toUpperCase()!=event.getNewValue())
    inputField.setValue(event.getNewValue().toUpperCase());
    In my case i change the input text to upercase when the value is changing
    I hope it works with output text also,
    change my examples clientlistener type from valueChange to mouseOver
    If you have more than one component and you need to pass parameters check this thread also:
    bug at af:clientAttribute 11.1.1.2.0
    Tilemahos

  • Need solution regarding input text component

    when the user enters some text in the input text field in the priview mode, the text entered by the user will fall in the destination only when the user clicks somewhere outside the component. else the entered text will not fall in the destination.can some one help providing a solution such that when the user enters some text it should immediately fall in the destination. if this component does not support this requirement is their any other component which could meet my requirement?

    Hi Divya,
    you can do it by simply taking a Input Text make the destination for the Text as one cell in Excel and take another component "push Button". Make the Push Button's source as the Destination of the Input Text and its Destination as another cell.
    Now after entering the text in Input Text and when u will click on push Button, it will insert the Text in Corresponding cell i.e Destination of Push Button. Now you can use that value as you want.
    Hope it will Help u.
    Thanks
    Prakash

  • How can we get the value from the af:selectInpuText component

    Hi,
    I have to get the value from af:selectInputText component when we click on af:selectInputText mirror icon.
    Edited by: durga on Aug 17, 2009 1:59 AM

    That was not what I was looking for. Because it would give null as value in my scenario. But I have solved that problem by passing the value of element in href. as window.open('www.sun.com?text='+document.getElementByID('req').value,'Blank',standards);
    Thanks for your comment.

  • How to get the value from the Input field of the Table view.

    Hi Experts,
    I have created a table view with 10 rows and each rows contains input fields in it.Can you please help me getting the values that are entered in all 10 rows.
    Currently I am using the below code,but using the below I am able to get only the first row details of the table.
      lo_el_table->get_static_attributes(
        IMPORTING
          static_attributes = ls_table).
    Please let me know you suggestions on this.Thanks in advance.
    Regards,
    Arun

    Hi Arun,
    You should use this method:
    lo_nd_table->get_static_attributes_table(
    IMPORTING
    table = lt_table).
    Cheers,
    Roelof
    http://www.nl4b.com

  • Getting the value of a html:text property in javascript function

    Hi all,
    I am using struts framework and I need to get a value in a textfield both in java part and javascript part
    <td><html:text property="identityNumber"> </td>
    I dont know how can I reach the value user entered in that field in the javascript function
    function verifyID(){
              var identityUserEntered = ????
    alert(identity);
    }

    the javascript expression document.forms[0].identityNumber.value should do it.
    You do realise you can't run java and javascript at the same time though right? The only way javascript can communicate with java is to submit an http request (normally submit form)

  • Disabling input text component on checking the checkbox

    Hi,
    I have created INPUT TEXT and CHECKBOX dynamically by the following code.
    List<UIComponent> children;
    children = pgl.getChildren();
    RichPanelGroupLayout pgll;
    pgll = new RichPanelGroupLayout();
    pgll.setLayout("horizontal");
    List<UIComponent> children1;
    children1 = pgll.getChildren();
    RichInputText it;
    it = new RichInputText();
    UIComponent cb = new RichSelectBooleanCheckbox();
    children1.add(it);
    children1.add(cb);
    children.add(pgll);
    Now on checking the checkbox i shud disable the inputtext box.. can someone help me out in getting it?

    In the valueChangeListener of the checkbox, set the disable propoerty of the input box to true and call the partial trigger on the input box using AdfFacesContext.addpartialTarget("idoftheinputbox"). Also set the partial submit of the checkbox to true.

  • How to set values in a CoreTable programmatically from a backing bean

    Hi,
    One of the columns in my CoreTable is "af:inputText" field, I need to set the value of inputText field in each row from a backing bean.
    I have bound this table to a component in the bakcing bean and in the setMyCoreTable method I'm also preselecting certain rows. For all the preselected rows I need to set a value in the inputText field.
    Can someone point me to some code samples or give me some ideas to solve this.
    Thanks

    Thanks dvohra,
    I looked at the post you suggested yesterday, but I wasnt sure how I can implement that in my case.
    Since Im programatically preselecting certain rows in the setMyCoreTable method(which is the accessor method), I was hoping I could prepopulate the input text field as well in the same method.
    For your reference below is the code from jspx and the backing bean.
    <af:table value="#{bindings.ProgramComponentList.collectionModel}"
    var="row"
    rows="#{bindings.ProgramComponentList.rangeSize}"
    first="#{bindings.ProgramComponentList.rangeStart}"
    emptyText="#{bindings.ProgramComponentList.viewable ? 'No rows yet.' : 'Access Denied.'}"
    selectionState="#{bindings.ProgramComponentList.collectionModel.selectedRow}"
    selectionListener="#{bindings.ProgramComponentList.collectionModel.makeCurrent}"
    binding="#{backing_EditProgramBean.compsTableComponent}">
    <af:column sortProperty="Name" sortable="true"
    headerText="#{bindings.ProgramComponentList.labels.Name}">
    <af:outputText value="#{row.Name}"/>
    </af:column>
    <af:column sortProperty="Description" sortable="true"
    headerText="#{bindings.ProgramComponentList.labels.Description}">
    <af:inputText value="#{row.Description}" simple="true"
    required="true"
    columns="30"/>
    </af:column>
    <f:facet name="selection">
    <af:tableSelectMany id="tableSelectMany1"/>
    </f:facet>
    </af:table>
    CODE FROM BACKING BEAN ---------
    public void setCompsTableComponent(CoreTable compsTableComp) {
    ManageProgramsServiceImpl serviceImpl =
    (ManageProgramsServiceImpl)JSFUtils.get("#{bindings.ProgramDetailIterator.dataControl.dataProvider}");
    ViewObject searchProgramView = serviceImpl.findViewObject("SearchProgramView");
    Row currProgram = searchProgramView.getCurrentRow();
    ViewObject view = serviceImpl.findViewObject("ProgramComponents");
    view.setWhereClause("ProgramsComponents.PROGRAM_ID = " + currProgram.getAttribute("ProgramId"));
    view.executeQuery();
    view.setRangeSize(view.getRowCount());
    view.executeQuery();
    Row[] programComponents = view.getAllRowsInRange();
    RowKeySet rks = new RowKeySet();
    ViewObject compTypesView = serviceImpl.findViewObject("ProgramComponentList");
    compTypesView.setRangeSize(compTypesView.getRowCount());
    compTypesView.executeQuery();
    Row[] compTypes = compTypesView.getAllRowsInRange();
    for (int i = 0; i < compTypes.length; i++) {
    String code = compTypes.getAttribute("Code").toString();
    for(int j=0; j<programComponents.length; j++){
    String programCode = programComponents[j].getAttribute("ComponentType").toString();
    if(programCode.equalsIgnoreCase(code)){
    rks.getKeySet().add(compTypes[i].getKey());
    compsTableComp.setSelectionState(rks);
    List li = compsTableComp.getChildren();
    System.out.println("****** li : " + li.size());
    //System.out.println("****** row count : " + compsTableComp.getRowCount());
    //System.out.println("****** count : " + compsTableComp.getRows());
    this.compsTableComponent = compsTableComp;
    The table children size(li.size()) comes up as zero and [compsTableComp.getRowCount()] gives an exception. Can you please provide any help. Seems like Im off track with this whole thing.
    Thanks

  • How to read values of dynamic UI elements in a backing bean?

    Hi, I have an ADF page where some of the UI elements (in this case, checkboxes) are dynamically rendered as such:
    <af:forEach var="row" items="#{backing_testPage.userList}">
    <af:selectBooleanCheckbox id="checkbox" value="#{row.id}"
    text="#{row.name}" selected="#{row.userSelected}"/>
    </af:forEach>
    I am wondering how can I read the values of these checkboxes in my page's backing bean. It does not seem possible to specify a distinct binding value for the selectBooleanCheckbox elements in order to tie them to a CoreSelectBooleanCheckbox variable in my backing bean (so that I could check whether the checkbox is selected or not).
    When the page gets rendered, I did see that the checkboxes get assigned distinct ids like checkbox_1, checkbox_2, checkbox_3, etc... Not sure if that would help with this.
    Would appreciate any tips on this as I've been struggling with this for awhile. Thanks!

    You probably would do better with a SelectManyCheckbox. Here's how:
    In your backing bean you need:
    private String[] usernames;
    public String[] getUsernames () {
      return usernames;
    public void setUsernames (String[] _usernames) {
      usernames = _usernames;
    }In your page:
    <af:selectManyCheckbox value="#{backing_testPage.usernames}">
      <f:selectItems value="#{backing_testPage.userList}"/>
    </af:selectManyCheckbox>When the form is rendered any strings in the usernames array that are in the userList will be checked. When submitted, any checked items will be in the array.

  • Setting focus on a component from backing bean

    Is there an easy way to set focus in a specific component on the jspx from a method in the backing bean? (other than javaScript coding...)

    Hi,
    did you take a look at
    About control the cursor position in a JSF web page
    It contains some links to other weblogs. The links are helpfull. Maybe you'll be able to find your solution there......
    Good luck
    Luc Bors

Maybe you are looking for

  • Creation of dynamic interal table and fieldcatalog for monat field

    Dear Experts, I am finding the average days of payments giving to our  vendors. for this i am passing company code, fiscal year , period and vendor in selection screen. Based on the period(monat)  i need to display the average days and finally i need

  • Slideshow works great in "live view" but does not in "preview browser"

    My slideshow looks just fine in "live view" but when I "preview in browser" it doesn't show up at all in Firefox and is a blue square with a question mark in Safari.  This was created in Dreamweaver and the slideshow is "Advanced Random Images" from

  • How to add ColorChecker Passport plugin to LR 5?

    I loaded this software from the X-rite's CD (it said "successfully"). In the Applications folder, I clicked on the icon - it allowed me to upgrade to the latest version (again "successfully"). When I opened LR 5 and opened Plugin Manager, it wasn't t

  • Why no stereo recording for Lumia 920 ?

    i have read at Nokia developers website that Lumia 920 have 3 High Dynamic Range Microphones. But during video recording , it does only mono recording despite of having 3 microphones (all knows stereo recording is better than mono) whereas the newly

  • MM SUS Invoice unit price issue

    Hello , We are using MM SUS invoice scenario. In MM PO has created for order quantity 2000 EA, and net price is 73.51 USD for 1000 per unit. During invoice, price information of item is like this: Price 0.07 USD, Per 1 EA and value is 147.02 USD But