Command_link rendered value binding causes NullPointerException

command_link is put in a data_table. Intiailly, data_table has no rows. The command_link's render attribute is binded to a property of a row bean. e.g.
<h:data_table id="resourcesTable"
  value="#{mainPubFormBean.resources}"
  binding="#{mainPubFormBean.dataUI}"
  var="resourceDataLine">
    <h:column>
      <h:command_link id="goToFolder"
      action="#{mainPubFormBean.goToResource}"
      rendered="#{resourceDataLine.folder}"
      title="#{resourceDataLine.localizedResourceName}">
       <h:output_text   value="#{resourceDataLine.abbreviatedResourceName}"
          styleClass="time-table-text"/>
       </h:command_link>
    </h:column>
</h:data_table>It causes NullPointerException,
java.lang.NullPointerException
        at javax.faces.component.UIComponentBase.isRendered(UIComponentBase.java:415)
        at javax.faces.webapp.UIComponentTag.isSuppressed(UIComponentTag.java:777)
        at javax.faces.webapp.UIComponentTag.doStartTag(UIComponentTag.java:447)
        at com.sun.faces.taglib.BaseComponentTag.doStartTag(BaseComponentTag.java:929)
        at org.apache.jsp.main_jsp._jspx_meth_h_command_link_6(main_jsp.java:1954)
        at org.apache.jsp.main_jsp._jspx_meth_h_column_0(main_jsp.java:1834)
        at org.apache.jsp.main_jsp._jspx_meth_h_data_table_0(main_jsp.java:1498)Here is the UIComponentBase.isRendered code fragment:
    public boolean isRendered()
        if(renderedSet)
            return rendered;
        ValueBinding vb = getValueBinding("rendered");
        if(vb != null)
            Boolean value = (Boolean)vb.getValue(getFacesContext());
            return value.booleanValue();  <----- value can be null
        } else
            return rendered;
    }The code should test if the value if null or not before calling booleanValue().

Thanks. Good news: we already nailed this bug.
-- Adam Winer

Similar Messages

  • Value binding not working with rendered attribute

    In my jsf page i'm encountering problem with value binding it is not working for a h:inputText with rendered condition even when the rendered condition evaluates to true & the component is rendered.While trying to retrieve the value of the components with conditional rendering on submit i'm unable to retreive the value while on removing rendered condition the value binding is working perfectly
    <h:selectOneMenu id="DropDown" value="#pc_GeneralRequestInfo.objInfoDTO.State}" rendered="#pc_GeneralRequestInfo.objAddressRequestDetailsDTO.selectedAddressType == 'HOME'}">                    
    <f:selectItems value="#{pc_GeneralRequestInfo.statesList}" />
    </h:selectOneMenu>

    There is a { missing from the value attribute in the code you posted.                                                                                                                                                                                           

  • H:selectOneMenu value binding to managed bean property

    Please help. Cannot figure out why selectOneMenu value binding is not working...
    The main contents of my jsp:
         <h:form id="form1" rendered="true">
              <P>
                   <h:selectOneMenu value="#{MBListBoxExample.selectedProject}" rendered="true"
                        required="false">
                        <f:selectItems value="#{MBListBoxExample.items}" />
                   </h:selectOneMenu>
              </P>
              <h:commandButton value="ShowSelected" rendered="true" action="#{MBListBoxExample.showSelected}" />
         </h:form>I have a managed bean with a property that is basically a custom object:
    private Project selectedProject;The selectOneMenu gets populated with the following code in my managed bean:
         public List getItems() {
              try {
                   ArrayList projectList = new ArrayList ();
                   projectList.add(new Project(1, "Project 1"));
                   projectList.add(new Project(2, "Project 2"));
                   projectList.add(new Project(3, "Project 3"));
                   projectList.add(new Project(4, "Project 4"));
                   ArrayList itemList = new ArrayList();
                   for (int x=0; x<projectList.size(); x++) {
                        SelectItem tempItem = new SelectItem();
                        Project tempProj = (Project) projectList.get(x);
                        tempItem.setLabel(tempProj.getName());
                        tempItem.setValue(tempProj);
                        itemList.add(tempItem);
                   return itemList;
              } catch (Exception e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
              return null;
         }The following code is tied to my command button to display some simple output when the button is clicked:
         public void showSelected() {
              System.out.println("The selected item is: " + selectedProject.getName());
         }If I set the value of the SelectItem (tempItem) above to a String and make the selectedProject variable of type String, the code works.
    My goal is to have the items in the list reference 'Project' objects and be able to get to the selected object when the user clicks the command button.
    Any help is greatly appreciated.

    The problem is that you're missing a converter. JSF needs to convert your values from Strings into Projects and vica verca.
    When you do the form submission the values are passed as strings along with the labels. JSF isn't smart enough to convert them automatically.

  • Refresh methodIterator cause NullPointerException

    HI Guys,
    I am using JDeveloper 10.1.3 and experiencing a strange problem with JSF Faces. I have a tree model defined in the pagedef.xml file. Every time I try to refresh the iterator binding, the NullPointerException occurs. It only happens when refreshing, not the first time. acccording to the trace stack, the exception occurs when ADF framework tries to refresh the iterator.
    Here is the code to refresh the iterator:
    DCIteratorBinding loansBinding = (DCIteratorBinding) bindings.get("findLoansIter");
    loansBinding.executeQuery();
    The following is the
    <methodIterator id="findLoansIter" Binds="findLoans.result"
    DataControl="PEPublicLocal" RangeSize="-1"
    BeanClass="pe.datamodule.beans.Loan" Refresh="renderModel"
    RefreshCondition="${adfFacesContext.postback}"/>
    <nodeDefinition DefName="pe.datamodule.beans.Loan" id="LoanNode">
    <AttrNames>
    <Item Value="dueDate"/>
    <Item Value="total"/>
    </AttrNames>
    <Accessors>
    <Item Value="loanextraCollection"/>
    </Accessors>
    </nodeDefinition>
    <nodeDefinition DefName="pe.datamodule.beans.Loanextra"
    id="LoanextraNode">
    <AttrNames>
    <Item Value="amount"/>
    <Item Value="loanExtraID"/>
    </AttrNames>
    </nodeDefinition>
    </tree>
    The exception is
    09/12/17 22:13:17 java.lang.NullPointerException
    09/12/17 22:13:17      at oracle.adf.model.generic.RowImpl.internalGetAttributeValue(RowImpl.java:154)
    09/12/17 22:13:17      at oracle.adf.model.generic.RowImpl.getAttribute(RowImpl.java:130)
    09/12/17 22:13:17      at oracle.jbo.uicli.binding.JUCtrlValueBinding.internalGetAttributeValueFromRow(JUCtrlValueBinding.java:702)
    09/12/17 22:13:17      at oracle.jbo.uicli.binding.JUCtrlValueBinding.getAttributeFromRow(JUCtrlValueBinding.java:470)
    09/12/17 22:13:17      at oracle.jbo.uicli.binding.JUCtrlValueBinding.getAttributes(JUCtrlValueBinding.java:901)
    09/12/17 22:13:17      at oracle.jbo.uicli.binding.JUCtrlHierNodeBinding.refresh(JUCtrlHierNodeBinding.java:504)
    09/12/17 22:13:17      at oracle.jbo.uicli.binding.JUCtrlHierNodeBinding.updateValuesFromRow(JUCtrlHierNodeBinding.java:523)
    09/12/17 22:13:17      at oracle.jbo.uicli.binding.JUIteratorBinding.updateValuesFromRows(JUIteratorBinding.java:315)
    09/12/17 22:13:17      at oracle.adf.model.binding.DCIteratorBinding.refreshControl(DCIteratorBinding.java:695)
    09/12/17 22:13:17      at oracle.adf.model.binding.DCIteratorBinding.rangeRefreshed(DCIteratorBinding.java:737)
    09/12/17 22:13:17      at oracle.jbo.common.RowSetHelper.fireRangeRefreshed(RowSetHelper.java:172)
    09/12/17 22:13:17      at oracle.adf.model.generic.DCRowSetIteratorImpl.notifyRangeRefreshed(DCRowSetIteratorImpl.java:1570)
    09/12/17 22:13:17      at oracle.adf.model.generic.DCRowSetIteratorImpl.buildProviderIterator(DCRowSetIteratorImpl.java:465)
    09/12/17 22:13:17      at oracle.adf.model.generic.DCRowSetIteratorImpl.fetchDataSource(DCRowSetIteratorImpl.java:394)
    09/12/17 22:13:17      at oracle.adf.model.generic.DCGenericRowSetIteratorImpl.notifyNavigationEvent(DCGenericRowSetIteratorImpl.java:331)
    09/12/17 22:13:17      at oracle.adf.model.generic.DCRowSetIteratorImpl.syncIterator(DCRowSetIteratorImpl.java:258)
    09/12/17 22:13:17      at oracle.adf.model.generic.DCRowSetIteratorImpl.first(DCRowSetIteratorImpl.java:653)
    09/12/17 22:13:17      at oracle.adf.model.binding.DCIteratorBinding.refreshControl(DCIteratorBinding.java:651)
    09/12/17 22:13:17      at oracle.adf.model.binding.DCIteratorBinding.rangeRefreshed(DCIteratorBinding.java:737)
    09/12/17 22:13:17      at oracle.jbo.common.RowSetHelper.fireRangeRefreshed(RowSetHelper.java:172)
    09/12/17 22:13:17      at oracle.adf.model.generic.DCRowSetIteratorImpl.notifyRangeRefreshed(DCRowSetIteratorImpl.java:1570)
    09/12/17 22:13:17      at oracle.adf.model.generic.DCRowSetIteratorImpl.buildProviderIterator(DCRowSetIteratorImpl.java:465)
    09/12/17 22:13:17      at oracle.adf.model.generic.DCRowSetIteratorImpl.fetchDataSource(DCRowSetIteratorImpl.java:394)
    09/12/17 22:13:17      at oracle.adf.model.generic.DCRowSetIteratorImpl.getRowAtAbsoluteIndex(DCRowSetIteratorImpl.java:1008)
    09/12/17 22:13:17      at oracle.adf.model.generic.DCRowSetIteratorImpl.syncIterator(DCRowSetIteratorImpl.java:225)
    09/12/17 22:13:17      at oracle.adf.model.generic.DCRowSetIteratorImpl.restoreCurrency(DCRowSetIteratorImpl.java:1821)
    09/12/17 22:13:17      at oracle.adf.model.generic.DCRowSetIteratorImpl.rebuildIteratorUpto(DCRowSetIteratorImpl.java:190)
    09/12/17 22:13:17      at oracle.adf.model.binding.DCDataControl.rebuildIteratorIfNeeded(DCDataControl.java:1696)
    09/12/17 22:13:17      at oracle.adf.model.generic.DCGenericDataControl.executeIteratorBindingIfNeeded(DCGenericDataControl.java:581)
    09/12/17 22:13:17      at oracle.adf.model.binding.DCIteratorBinding.executeQueryIfNeeded(DCIteratorBinding.java:1825)
    09/12/17 22:13:17      at oracle.jbo.uicli.binding.JUMethodIteratorDef$JUMethodIteratorBinding.executeQueryIfNeeded(JUMethodIteratorDef.java:289)
    09/12/17 22:13:17      at oracle.jbo.uicli.binding.JUMethodIteratorDef$JUMethodIteratorBinding$1.afterInvokeMethod(JUMethodIteratorDef.java:221)
    09/12/17 22:13:17      at oracle.adf.model.binding.DCInvokeMethod.notifyAfterInvokeMethod(DCInvokeMethod.java:667)
    09/12/17 22:13:17      at oracle.adf.model.binding.DCInvokeMethod.callMethod(DCInvokeMethod.java:228)
    Please help! This has bother me for more than a week!
    Thanks in advance

    Hi Juan,
    What do you mean by removing the query? I have the same idea like you do. I tried to close or clear or remove or release the previous query result and it did not work. I did not know whether I did not close the result properly or the refresh did not go properly. Anyway, the exception still show up. I even tried to release the rowSetIterator behind the IteratorBinding, not working.
    ( this is another question I have. I don't know how to release the query result for a page. I don't want to have the previous page query result show up when I navigate back to the same page. any idea?)
    I think the problem is where the framework tries to apply the new query result on the top of the old result and that's why it called refreshControl. The whole problem happend during that refresh control.
    If I switch the tree to table, it works immediately. If I adjust the tree to one level, it works immediately. If I only put one attribute at the first level, it works immediately.
    Also, I am using JSF/ADF with Toplink and web service. I don't know how to verify whether the model lay works or not. but like I said, the first time work always. or if I intentionally make the query result to be no record, then trying it again always works.
    Please help!
    thanks
    Steven

  • How to get the rendered value of a cell in a table

    Hi All
    I am using a DateCellRenderer to display the date in a particular cell in the format "MM/dd/yyyy HH:mm" instead of the long date format. My proble is that when I try to retrieve the value using table.getModel().getValueAt(row, column), it returns the value in the long date format instead of the format "MM/dd/yyyy HH:mm".
    Is there anyway to get the actual rendered value of this cell.
    Rahul

    The value that is returned from the model is the actual Date object. If you want to format that Date object into a string like it is rendered, then just create a date formatter using the same pattern to output it. Trying to force the renderer to render the string seems like you are pounding a nail in with a bowling ball. Yes, it will work... but why are you doing it. :-) And you are forced to make assumptions about how the renderer works... is a label, etc.
    Seems to me it would be far more clear to staticly define the pattern you are using for formatting dates. Use that pattern string in your renderer, and use it for creating another date formatter for your other tasks. Update it once to modify all uses. Remember that date formatters are not thread safe, and should not be shared unless you are very careful. So share the pattern, not the formatter.

  • How to declare value binding to array list element in a pojo?

    I have a POJO called P, that contains an ArrayList member called w.
    class P {
    private ArrayList w = new ArrayList(5);
    w is initied in the class constructor.
    The POJO is in the SessionBean and I would like to reference individual
    elements in the ArrayList via a value binding like so;
    #{SessionBean1.instanceOfP.w[5]}
    I'm not sure how to declare the getter/setter for member W in POJO P
    so that setter and getter injection work.

    You may not be able to directly set the indexed value.
    Try some thing like this.
    Add a property that returns the indexed value.
    Ex. if you ArrayList objets are of type "String"
    int index = 5;
    public String getMyValue(){
    return w.get[index]
    Now your value binding would look something like
    #{SessionBean1.myValue}
    BTW, if you want to access different index, create another method
    public void setIndex(int index){
    this.index = index;
    - Winston
    http://blogs.sun.com/roller/page/winston?catname=Creator

  • Faces config exception - Can't get value from value binding expression:

    the menuItem_Department shown property takes value from userRight's session bean object userDetail.
    class UserRights{
        public boolean mDept = false;
        public boolean loggedIn = false;
        public boolean admin = false;
       //accessors
    }now, the shown property picks correct value for #{userDetail.admin} but gives erros on this. any idea how to get around this exception:
    Managedbean menuItem_Department could not be created Can't get value from value binding expression: '#{userDetail.mDept}'.
    javax.faces.FacesException: Can't get value from value binding expression: '#{userDetail.mDept}'     at com.sun.faces.config.ManagedBeanFactory.evaluateValueBindingGet(ManagedBeanFactory.java:903)
         at com.sun.faces.config.ManagedBeanFactory.setPropertiesIntoBean(ManagedBeanFactory.java:547)
         at com.sun.faces.config.ManagedBeanFactory.newInstance(ManagedBeanFactory.java:233)
         at com.sun.faces.application.ApplicationAssociate.createAndMaybeStoreManagedBeans(ApplicationAssociate.java:256)
    .. stack tracepointers appreciated.
    reagrds
    Rabs

    well, i figured out the problem so thought to share with all aswell.
    all i changed was the name of the variable from mDept to dept.
    java beans has its own set of rules and naming conventions which i have not read much about but this problem had to do sumthing with that!
    just changing the name simply works fine!

  • Using value binding expressions to set 'required' attribute

    I am trying to use a value binding expression to determine whether the value of various input control's is required or not according to where they are used and not having much luck. I wonder if anyone can shed some light on this...
    The following expression works: <h:inputText id="name" required="#{true}"/> whereas <c:set var="required" value="true" scope="request"/>
    <h:inputText id="name" required="#{required}"/> does not, even though the expression evaluates to true! I have tried numerous variations (requestScope.required, required == true, required ? true : false, etc.) to no avail. Interestingly, #{1 == 1} or binding to a backing bean method works, but as soon as you add a request variable it breaks.
    Am I doing something wrong, is this something that JSF doesn't allow, or just a bug in the RI? Note that I don't want to vary this flag between multiple submissions of the same form, I am just trying to reuse the same JSP include to generate form controls for required and optional data on different forms to avoid a whole lot of cutting any pasting.
    Any pointers gratefully received.
    -- Keith Wilson

    I had something like this happen, and here's what I concluded the problem was. Perhaps your problem is similar.
    In the first non-working example you show a request-scope variable being set in the JSP page, and then use that to set the "required" attribute. But consider what happens when you submit the form. There is no longer any request-scope variable set because we have a new request and we don't go through the JSP page! (Not before validation is checked, anyhow).
    So basically I concluded that the variable had to be in (say) session scope for it to work as you would like.

  • SelectMany checkbox value-binded with HashMap String,ArrayList

    Hello,
    Someone can help me please?
    Im trying to create a page with a lot of HtmlSelectManyCheckbox, and i need to value-bind then to the same Object in my BackingBean.
    First i attemped to bind all HtmlSelectManyCheckbox with a single ArrayList, but only the last SelectMany had their values inserted on the ArrayList...
    So, now im trying to bind all the HtmlSelectManyCheckbox with a HashMap<String,ArrayList>, because i would have just one object and for each entry I would have the checkboxes that were cheked in a single HtmlSelectManyCheckbox.
    Now my question: there is a way to make this work?
    my code example
    Backing bean
    private HashMap<String, ArrayList> respostaMatrizCheck = new HashMap<String, ArrayList>();
         public HashMap<String, ArrayList> getRespostaMatrizCheck() {
              return respostaMatrizCheck;
         public void setRespostaMatrizCheck(HashMap<String, ArrayList> respostaMatrizCheck) {
              this.respostaMatrizCheck = respostaMatrizCheck;and the bindings
    <h:selectManyCheckbox value="#{backingBean.respostaMatrizCheck['1'] }">
    <h:selectManyCheckbox value="#{backingBean.respostaMatrizCheck['2'] }">And the error message given when i tryed this is the following:
    javax.servlet.ServletException: ValueBinding for UISelectMany must be of type List or Array
    Any help would be welcome.
    Thanks,
    Ferry

    Has anybody solved a problem like this? I am facing the same problem and no response helped me so far.
    Here is the web code:
    <h:selectManyCheckbox value="#{processor.languages.languages1}">
         <f:converter converterId="languageConverter" />
         <f:selectItems value="#{categoryController.allLanguagesAsSelectItems}" />
    </h:selectManyCheckbox>My backing bean "processor" looks like this:
         public Map<String, List<MyObject>> getLanguages() {
              return languagesMap;
         }(The backing bean has no "setLanguages()-method" since I did not need any with Map<String, String> for example.)
    The converter I use creates a "MyObject" instance in its "getAsObject" conversion method.
    I think everything should be okay then but the exception I get after submitting the page is:
    java.lang.IllegalArgumentException: ValueBinding for UISelectMany must be of type List or Array
         org.apache.myfaces.shared_impl.renderkit._SharedRendererUtils.getConvertedUISelectManyValue(_SharedRendererUtils.java:191)
         org.apache.myfaces.shared_impl.renderkit.RendererUtils.getConvertedUISelectManyValue(RendererUtils.java:630)
         org.apache.myfaces.shared_impl.renderkit.html.HtmlCheckboxRendererBase.getConvertedValue(HtmlCheckboxRendererBase.java:308)
         javax.faces.component.UISelectMany.getConvertedValue(UISelectMany.java:308)
         javax.faces.component.UIInput.validate(UIInput.java:350)
    .....Edited by: rapthor on Oct 31, 2007 6:39 AM

  • Using value binding expression for to-view-id

    hi;
    is it possible to use a value binding expression in the <to-view-id> element?
    if not, is there a logical reason for this?
    thanks

    Shrek-2:
    Are we there yet?No
    Are we there yet?No
    Are we there yet?Yes
    Really?
    NO
    Seriously, the default navigation handler does not allow to use EL for the to-view-id, but you can obtain the desire behaviour with the custom handler decorator.
    This is a code snippet:
         public void handleNavigation(FacesContext fc, String actionMethod, String actionName) {
              _base.handleNavigation(fc, actionMethod, actionName);
              String viewId = fc.getViewRoot().getViewId();
            if ((viewId.indexOf("#{") != -1) &&
                    (viewId.indexOf("#{") < viewId.indexOf('}'))) {
                 String bviewId = (String)fc.getApplication().createValueBinding(viewId).getValue(fc);
                 if (bviewId != null)
                      fc.getViewRoot().setViewId(bviewId);
                 else {
                      // you can throw the exception here
         }More about HandlerDecorator:
    http://www.jsftutorials.net/jsfNavigation/jsf-login-navigation-redirect.html
    http://www.jsftutorials.net/faces-config/navigationDecorator.html
    P.S. Note: This feature might broke the separation between the different levels of application from the architectural point of view. Hard-coding the ViewIds inside the java code is not a good idea at all.
    Sergey : jsfTutorials.net

  • Localized String with params - Value Binding Expression...

    Hi All:
    I see many e.g.s where a command button / or a label's value can be a localized resource string using the generic value binding expression:
    "#{bundleVarName.keyName}"
    what if the resource string has parameters? for e.g.
    button.caption = Click Me for {0}
    Can we assign a value binding expression with params for button captions etc.
    Please help - I am a newbie in JSF,,,
    regards
    -Somesh

    JSF developers have forgotten about this :)
    Use other tools for displaying such messages (f. e. JSTL) where you need to have parametrized messaged.
    But mostly, non-parameterized JSF will be enough.

  • Dynamic value binding for InputTextField - Expression within an expression

    Hi,
    I have this requirement where I have to use an EL expression's output as a bean's property in the value attribute of a InputTextField. E.g.
              <h:dataTable value="#{entity.formats}" var="field">
                   <h:column>
                        <h:outputLabel value="#{field.shortDesr}"/>
                   </h:column>
                   <h:column>
                        <h:inputText value="#{*entity."+#{field.shortDesr}+*"}"/>     
                   </h:column>     
              </h:dataTable>
    The JSF page will be a generic one so the fields within a form will be dynamic and will be formed at run-time. Since the exact bean property(entity in the code above) for a particular field is not known before, it needs to be dynamicaly built
    To give more clarity. In the following snippet, i know that entity is the bean to be used but which property(XXX) the text field has to be bound is not known and needs to be assigned at run-time.
    <h:inputText value="#{entity.*XXX*"/>     
    Is this possible? Are there any direct JSF solution or work arounds for it? Appreciate your inputs.
    Thanks
    Ranjith

A: Dynamic value binding for InputTextField - Expression within an expression

Hi BaluSC,
Your solution is totally acceptable. But I was also looking for something that can make possible direct binding to the bean properties without going through a Map.
In the meantime, I worked around the problem by not using the DataTable. Instead I loop the collection and add the Form elements programatically (code given below). With this I am able to achieve the desired effect of binding directly to the bean's property. But I am hitting another problem now, On submit the form Seam throws up 'No active conversational context" error while binding the #{sdmManager.grid} attribute. Now, I am trying to figure out how to come across it.
JSF
     <h:panelGrid columns="2" binding="#{sdmManager.grid}">
</h:panelGrid>
Bean code
     public HtmlPanelGrid getGrid(){
     grid = new HtmlPanelGrid();
     List<UIComponent> children = grid.getChildren();
     Collection<FieldFormatData> formats = dataManager.getFieldFormatData();
     for(FieldFormatData format:formats){
          HtmlOutputLabel outputLabel = new HtmlOutputLabel();
          outputLabel.setValue(format.getShortDesr());
          children.add(outputLabel);
          HtmlInputText inputText = new HtmlInputText();
          inputText.setSize(10);
          inputText.setMaxlength(10);
          System.out.println("Binding ................................... " + format.getEntityField());
          inputText.setValueBinding("value", FacesContext.getCurrentInstance().getApplication().createValueBinding("#{entity."+format.getEntityField()+"}"));
          children.add(inputText);
     return grid;

Hi BaluSC,
Your solution is totally acceptable. But I was also looking for something that can make possible direct binding to the bean properties without going through a Map.
In the meantime, I worked around the problem by not using the DataTable. Instead I loop the collection and add the Form elements programatically (code given below). With this I am able to achieve the desired effect of binding directly to the bean's property. But I am hitting another problem now, On submit the form Seam throws up 'No active conversational context" error while binding the #{sdmManager.grid} attribute. Now, I am trying to figure out how to come across it.
JSF
     <h:panelGrid columns="2" binding="#{sdmManager.grid}">
</h:panelGrid>
Bean code
     public HtmlPanelGrid getGrid(){
     grid = new HtmlPanelGrid();
     List<UIComponent> children = grid.getChildren();
     Collection<FieldFormatData> formats = dataManager.getFieldFormatData();
     for(FieldFormatData format:formats){
          HtmlOutputLabel outputLabel = new HtmlOutputLabel();
          outputLabel.setValue(format.getShortDesr());
          children.add(outputLabel);
          HtmlInputText inputText = new HtmlInputText();
          inputText.setSize(10);
          inputText.setMaxlength(10);
          System.out.println("Binding ................................... " + format.getEntityField());
          inputText.setValueBinding("value", FacesContext.getCurrentInstance().getApplication().createValueBinding("#{entity."+format.getEntityField()+"}"));
          children.add(inputText);
     return grid;

  • If I consider heap size, should I follow component binding or Value binding

    Hi,
    I have an Web application my pages gets change rapidly in run time(components get disable and invisible at run-time depends on user input), So in that case which kind of binding approach I have to follow if I consider Heap memory of run time.

    navaneeth.j wrote:
    I am getting more grip on the component means, in ValueChange event I can get the updated value in the backing bean, That means on the updated values of the rest of the components are not available only we can get evt.getNewValue for event produced component. Example there are 5 components in the page if the event got generated from the 3rd component so in that valuechange event method needs the first two components values also. In value binding I can't get those value but in the component binding every component's updated value I can get.That's why I mentioned AJAX enabling the view in the previous post.
    I can accept for 3rd party libraries if we use value binding it would be very easy to detach and use another one but for basic components I am not able to visualize the need to use the other >API, If my guess is right, for look and feel purpose means we can change the renderkit na.
    Please suggest me am I thinking in the right direction or notRichfaces, Tomahawk and many others have lots of components that solve common problems that you are going to meet when using plain JSF components.
    Yes people try to stick to standard JSF as much as possible but it is not always possible nor always beneficial.
    Like I said it's not hard and fast. As long as you understand the advantages and disadvantages of each technique so that you can chose the correct approach according to requirements.
    The memory differences are unlikely to impact in a major way.

  • Question on value binding

    Hi I am trying to put 2 value binding statements into one method "ok()" in the backing bean. here they are.
         FacesContext context = FacesContext.getCurrentInstance();
         ValueBinding vb = context.getApplication().createValueBinding(
                   "#{LoginBean.subject}" );
    Subject subject = (Subject)vb.getValue( context );and
         FacesContext context = FacesContext.getCurrentInstance();
         ValueBinding vb = context.getApplication().createValueBinding(
              "#{UserGroupBrowserBean.selectedGroupName}" );
         vb.setValue( context, newGroup );This is giving me the error when i try to build it as follows:
    "context is already defined in ok()" and "vb is already defined in ok()"
    How do I fix this. how do i insert the second value binding expression in the method. any help hugely appreciated. 5DD's
    thanks
    joe

         ValueBinding vb0, vb1;
            FacesContext context = FacesContext.getCurrentInstance();
         Application ap = context.getApplication();
            vb0 = ap.createValueBinding("#{LoginBean.subject}" );
            Subject subject = (Subject)vb0.getValue(context);
         vb1 = ap.createValueBinding("#{UserGroupBrowserBean.selectedGroupName}");
         vb1.setValue(context,  newGroup);Does your bean have proper setter/getter methods for them properties?

  • Value binding InputText

    Hi All,
    I've a some string generated in backing bean on page load of the same page. How to bind that string to an InputText of the same .jspx page.
    Regards,

    Hi,
    Can u please just go through the following link for same problem..which i'd posted earlier..with code Snippet.
    InputText value binding issue
    Here i'm not getting any value in the InputText.
    Regards,

  • Maybe you are looking for