H:dataTable Problem

Hi,
I have a SearchBean class which is a managed bean. It has a SearchResults Class. The SearchResults class has a few integers, and a ArrayList of SearchData.
This works
<h:outputText value="#{jci_SearchBean.searchResults.searchDataList[0].title}" />Which shows that there is a valid arraylist, and the title is being printed.
But this doesn't
<h:dataTable value="#{jci_SearchBean.searchResults.searchDataList}" var="searchDataBean">
</h:dataTable>As soon as I add the second piece of code, I get a huge error, about some NullPointerException being thrown.
The getSearchDataList() method of SearchResults is not even being called by the data table. Whereas it is being called by output text.
Please help as I have tried everything, and now I am getting frustrated. Am I missing something obvious here?
Thanks
PS: I am using WebSphere Portal 6.0

Ok. Now I have replaced that code with this and it works. But this is IBM specific if I am not mistaken.
<hx:scriptCollector id="scriptCollector1">
          <hx:dataTableEx border="0" cellpadding="2" cellspacing="0"
               id="tableEx1" value="#{jci_SearchBean.searchResults.searchDataList}" var="varsearchDataList">
               <hx:columnEx id="columnEx1">
                     <h:outputText style="font-weight:bold;" value="#{varsearchDataList.title}" />
               </hx:columnEx>
               <hx:columnEx id="columnEx2">
                    <h:outputText value=" - " />
               </hx:columnEx>
               <hx:columnEx id="columnEx3">
                    <h:outputText value="#{varsearchDataList.description}" />
               </hx:columnEx>
          </hx:dataTableEx>
     </hx:scriptCollector>Should I just stick to hx instead of h???
Message was edited by:
Greesh

Similar Messages

  • Adf datatable problem

    i'm new to jsf
    i ve a selectonechoice menu , a datatable,and a save button on my page
    the user selects form the menu then i fill the list for the datatable in the backing bean
    then the user edit the datatable and press save button to save the changes
    the problem is that when i want to traverse the datatable in the save button action
    i found the number of rows is 0
    i don't know how to handle this
    how to retrieve the edited data from the datatable
    thnks for reading

    Hi,
    first of all you will need to give us some information about the model that the table writes to. If you only use the table component then the data is not persisted at all. So there must be a a managed bean or similar that provides the data model.
    Frank

  • JSF dataTables - Problem during retrieving data from bean

    Hi, Below is the Stack Trace got on displaying data using JSF datatables.
         This error occurs somtimes and is not very frequent.We are using jboss seam, jboss-4.0.5.GA server and Hibernate.
         Anyone knows about this problem and how it can be resolved?
         Thanks in advance
         javax.faces.el.EvaluationException: Cannot get value for expression '#{loc.companyName}'
              at org.apache.myfaces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:402)
              at javax.faces.component.UIComponentBase.isRendered(UIComponentBase.java:1075)
              at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:508)
              at org.apache.myfaces.shared_impl.renderkit.RendererUtils.renderChild(RendererUtils.java:433)
              at org.apache.myfaces.shared_impl.renderkit.html.HtmlGridRendererBase.renderChildren(HtmlGridRendererBase.java:216)
              at org.apache.myfaces.shared_impl.renderkit.html.HtmlGridRendererBase.encodeEnd(HtmlGridRendererBase.java:98)
              at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:536)
              at javax.faces.webapp.UIComponentTag.encodeEnd(UIComponentTag.java:495)
              at javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:363)
              at org.apache.myfaces.shared_impl.taglib.UIComponentBodyTagBase.doEndTag(UIComponentBodyTagBase.java:54)
              at org.apache.jsp.menu_jsp._jspx_meth_h_panelGrid_0(menu_jsp.java:225)
              at org.apache.jsp.menu_jsp._jspx_meth_f_subview_0(menu_jsp.java:118)
              at org.apache.jsp.menu_jsp._jspService(menu_jsp.java:87)
              at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
              at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
              at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
              at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
              at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
              at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:574)
              at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:499)
              at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:966)
              at org.apache.jsp.finish_005fregistration_jsp._jspx_meth_h_form_0(finish_005fregistration_jsp.java:263)
              at org.apache.jsp.finish_005fregistration_jsp._jspx_meth_f_view_0(finish_005fregistration_jsp.java:139)
              at org.apache.jsp.finish_005fregistration_jsp._jspService(finish_005fregistration_jsp.java:93)
              at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
              at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
              at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
              at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
              at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
              at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
              at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
              at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
              at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:416)
              at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:234)
              at org.jboss.seam.jsf.SeamViewHandler.renderView(SeamViewHandler.java:59)
              at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:384)
              at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
              at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:147)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
              at com.kmedia.filter.RequestFilter.doFilter(RequestFilter.java:184)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
              at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
              at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
              at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
              at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
              at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
              at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
              at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
              at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
              at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
              at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
              at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
              at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
              at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
              at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
              at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
              at java.lang.Thread.run(Thread.java:595)
         Caused by: java.lang.NullPointerException
              at org.jboss.mx.loading.RepositoryClassLoader.findClass(RepositoryClassLoader.java:620)
              at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
              at org.jboss.mx.loading.RepositoryClassLoader.loadClassImpl(RepositoryClassLoader.java:464)
              at org.jboss.mx.loading.RepositoryClassLoader.loadClass(RepositoryClassLoader.java:405)
              at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
              at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
              at org.jboss.seam.jsf.SeamApplication11.getPropertyResolver(SeamApplication11.java:197)
              at org.apache.myfaces.el.ELParserHelper$MyPropertySuffix.evaluate(ELParserHelper.java:532)
              at org.apache.commons.el.ComplexValue.evaluate(ComplexValue.java:145)
              at org.apache.commons.el.BinaryOperatorExpression.evaluate(BinaryOperatorExpression.java:154)
              at org.apache.myfaces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:383)
              ... 70 more
         10:23:55 Servlet.service() for servlet jsp threw exception
         Also check the JSF page, Backing bean, and VO
         JSF page
         <h:dataTable value="#{finishedRegistrationBean.list}" var = "loc" >
                        <h:column>
         <f:facet name="header">
                        <h:outputText value="#{displaymessages.registrationDate}" />
                        </f:facet>
                        <span class="bodylighttext"> <h:outputText value="#{loc.registrDate}" /> </span>
                                                                                                   </h:column>
                        <h:column>
                        <f:facet name="header">
                        <h:outputText value="#{displaymessages.companyName}" />
                        </f:facet>
                        <span class="bodylighttext"> <h:outputText
                        value="#{loc.companyName}" /> </span>
                        </h:column>
                        <h:column>
                        <f:facet name="header">
                             <h:outputText value="#{displaymessages.Address}" />
                             </f:facet>
                        <span class="bodylighttext"> <h:outputText
                        value="#{loc.address}" /> </span>
                        </h:column>
                        <h:column>
                        <f:facet name="header">
                        <h:outputText value="#{displaymessages.Action}" />
                        </f:facet>
                        <h:commandLink target="_blank"
                        action="#{finishedRegistrationBean.viewFinishedRegistrationPage(loc)}">
                        <h:graphicImage value="images/view_icon.gif"
                        alt="#{displaymessages.info_tooltip_view}"
                        width="17" height="17" style="border:0" />
                        </h:commandLink>
                        </h:column>
    </h:dataTable>
    Backing bean
                        @Name("finishedRegistrationBean")
                        public class FinishedRegistrationBean {
                             @In
                             private User user;
                             @In
                             private FacesMessages facesMessages;
                             private List<FinishedRegistrationVO> list;
                             public FinishedRegistrationBean() throws KMException {
                                  filterFinishedRegistration();
                             public void filterFinishedRegistration() throws KMException
                             list = new ArrayList<FinishedRegistrationVO>();
                             finished_list = userDAO.searchFinishedRegistrationDetails(country_code,uniqueID, companyName, user.getUserName());
                             public void setList(List<FinishedRegistrationVO> list) {
                                  this.list = list;
                             public List<FinishedRegistrationVO> getList() {
                             return list;
    FinishedRegistrationVO
         public class FinishedRegistrationVO {
              private String uniqId;
              private String companyName;
              private Date registrDate;
              private String address;
              public String getCompanyName() {
                   return companyName;
              public void setCompanyName(String companyName) {
                   this.companyName = companyName;
              public String getAddress() {
                   return address;
              public void setAddress(String address) {
                   this.address = address;
              public String getUniqId() {
                   return uniqId;
              public void setUniqId(String uniqId) {
                   this.uniqId = uniqId;
              public Date getRegistrDate() {
                   return registrDate;
              public void setRegistrDate(Date registrDate) {
                   this.registrDate = registrDate;
         }

    Could you please post your
    -HBM
    -faces-config.xml

  • JSF Datatable inside a datatable problems

    Hi,
    i am having a datatable with 3 rows mapping to a column in the database table..now i have another datatable inside the previous datatable mapping to another column in the database.... i am able to fetch the values from the database and populate in the 2 datatables.my first datatable has one column and it is a component label.my second datatable has 4 columns..a select many checkboxes,a component label,and 2 text fields.
    Now the problem comes when i need to save the values that are being entered in the datatable..how do i get the values of the checkbox and the textfields and update in the database.and remember i need to get the values of all the components in both the datatables and update in the database...my JSP code and the backing bean codes are as follows.......pls help me with this problem
    JSP Code:
    <h:dataTable binding="#{AttributeSelection.uiTable2}" id="dataTable2" rowClasses="form"
    value="#{AttributeSelection.arrayDataModel}" var="currentRow1">
    <h:column binding="#{AttributeSelection.column5}" id="column5">
    <h:outputText binding="#{AttributeSelection.outputText1}" id="outputText1" value=""/>
    <f:facet name="header"/>
    <h:dataTable binding="#{AttributeSelection.uiTable1}" border="1" headerClass="form_bold"
    id="dataTable1" rowClasses="form" value="#{currentRow1['attributes']}" var="currentRow">
    <h:column binding="#{AttributeSelection.column1}" id="column1">
    <h:selectBooleanCheckbox binding="#{AttributeSelection.checkbox1}" id="checkbox1" value="#{currentRow.checkbox1}"/>
    <f:facet name="header"/>
    </h:column>
    <h:column binding="#{AttributeSelection.column2}" id="column2">
    <h:outputText binding="#{AttributeSelection.outputText3}" id="outputText3" value="#{currentRow['name']}"/>
    <f:facet name="header">
    <h:outputText binding="#{AttributeSelection.outputText4}" id="outputText4"
    style="height: 23px; width: 50%" styleClass="form_bold" value="#{currentRow1['category']}"/>
    </f:facet>
    </h:column>
    <h:column binding="#{AttributeSelection.column3}" id="column3">
    <h:inputText binding="#{AttributeSelection.textField1}" id="textField1"
    style="height: 24px; width: 65%" styleClass="input" value="#{currentRow['defaultMin']}"/>
    <f:facet name="header">
    <h:outputText binding="#{AttributeSelection.outputText8}" id="outputText8" value="Min"/>
    </f:facet>
    </h:column>
    <h:column binding="#{AttributeSelection.column4}" id="column4">
    <h:inputText binding="#{AttributeSelection.textField2}" id="textField2"
    style="height: 24px; width: 65%" styleClass="input" value="#{currentRow['defaultMax']}"/>
    <f:facet name="header">
    <h:outputText binding="#{AttributeSelection.outputText9}" id="outputText9" style="" value="Max"/>
    </f:facet>
    </h:column>
    </h:dataTable>
    </h:column>
    </h:dataTable>
    Backing Bean Code:
    * AttributeSelection1.java
    * Created on January 23, 2006, 10:46 AM
    * Copyright Sidharth_Mohan
    package tpalt;
    import com.equifax.ems.tpalt.order.dao.OrderDataDAO;
    import javax.faces.*;
    import com.sun.jsfcl.app.*;
    import javax.faces.component.html.*;
    import com.sun.jsfcl.data.*;
    import java.util.ArrayList;
    import javax.faces.component.*;
    import javax.faces.model.ArrayDataModel;
    import com.equifax.ems.tpalt.order.model.OrderAttribute;
    import com.equifax.ems.tpalt.order.model.OrderCategory;
    import com.sun.faces.el.MethodBindingImpl;
    import java.util.Iterator;
    import java.util.Map;
    import javax.faces.application.Application;
    import javax.faces.context.FacesContext;
    import javax.faces.el.MethodBinding;
    public class AttributeSelection extends AbstractPageBean {
    * Bean initialization.
    // </editor-fold>
    public AttributeSelection() {
    // <editor-fold defaultstate="collapsed" desc="Creator-managed Component Initialization">
    try {
    } catch (Exception e) {
    log("AttributeSelection Initialization Failure", e);
    throw e instanceof javax.faces.FacesException ? (FacesException) e : new FacesException(e);
    // </editor-fold>
    // Additional user provided initialization code
    protected tpalt.ApplicationBean1 getApplicationBean1() {
    return (tpalt.ApplicationBean1)getBean("ApplicationBean1");
    protected tpalt.SessionBean1 getSessionBean1() {
    return (tpalt.SessionBean1)getBean("SessionBean1");
    // </editor-fold>
    * Bean cleanup.
    protected void afterRenderResponse() {
    }private int __placeholder;
    private HtmlForm form1 = new HtmlForm();
    public HtmlForm getForm1() {
    return form1;
    public void setForm1(HtmlForm hf) {
    this.form1 = hf;
    public UIData uiTable1 = new UIData();
    * Getter for property uiTable.
    * @return Value of property uiTable.
    public UIData getUiTable1() {
    return uiTable1;
    * Setter for property uiTable.
    * @param uiTable New value of property uiTable.
    public void setUiTable1(UIData uiTable1) {
    this.uiTable1 = uiTable1;
    private UIColumn column1 = new UIColumn();
    public UIColumn getColumn1() {
    return column1;
    public void setColumn1(UIColumn uic) {
    this.column1 = uic;
    private UIColumn column5 = new UIColumn();
    public UIColumn getColumn5() {
    return column5;
    public void setColumn5(UIColumn uic) {
    this.column5 = uic;
    private HtmlOutputText outputText1 = new HtmlOutputText();
    public HtmlOutputText getOutputText1() {
    return outputText1;
    public void setOutputText1(HtmlOutputText hot) {
    this.outputText1 = hot;
    public UIData uiTable2 = new UIData();
    * Getter for property uiTable.
    * @return Value of property uiTable.
    public UIData getUiTable2() {
    return uiTable2;
    * Setter for property uiTable.
    * @param uiTable New value of property uiTable.
    public void setUiTable2(UIData uiTable2) {
    this.uiTable2 = uiTable2;
    private ArrayDataModel arrayDataModel = new ArrayDataModel();
    public ArrayDataModel getArrayDataModel() {
    ArrayList orderList =new ArrayList();
    OrderDataDAO orderData =new OrderDataDAO();
    ArrayList orderCategories = new ArrayList();
    try
    orderList = (ArrayList) orderData.getAllAttributes();
    for (int i =0;i<orderList.size();i++)
    OrderAttribute or =(OrderAttribute)orderList.get(i);
    //or.setCheckbox1(true);
    String category = (String)or.getCategory();
    OrderCategory orderCategory = new OrderCategory();
    ArrayList attributesforCategory = new ArrayList();
    for (int j = i;j<orderList.size();j++){
    OrderAttribute ora =(OrderAttribute)orderList.get(j);
    if (category.equals(ora.getCategory())){
    attributesforCategory.add(ora);
    orderList.remove(j);
    j = i;
    orderCategory.setCategory(category);
    orderCategory.setAttributes(attributesforCategory);
    orderCategories.add(orderCategory);
    //dataTable2Model.setWrappedData(orderCategories);
    arrayDataModel = new ArrayDataModel(orderCategories.toArray());
    catch (Exception ex) {
    return arrayDataModel;
    public void setArrayDataModel(ArrayDataModel dtdm) {
    this.arrayDataModel = dtdm;
    private UIColumn column2 = new UIColumn();
    public UIColumn getColumn2() {
    return column2;
    public void setColumn2(UIColumn uic) {
    this.column2 = uic;
    private HtmlOutputText outputText3 = new HtmlOutputText();
    public HtmlOutputText getOutputText3() {
    return outputText3;
    public void setOutputText3(HtmlOutputText hot) {
    this.outputText3 = hot;
    private UIColumn column3 = new UIColumn();
    public UIColumn getColumn3() {
    return column3;
    public void setColumn3(UIColumn uic) {
    this.column3 = uic;
    private HtmlOutputText outputText4 = new HtmlOutputText();
    public HtmlOutputText getOutputText4() {
    return outputText4;
    public void setOutputText4(HtmlOutputText hot) {
    this.outputText4 = hot;
    private UIColumn column4 = new UIColumn();
    public UIColumn getColumn4() {
    return column4;
    public void setColumn4(UIColumn uic) {
    this.column4 = uic;
    private HtmlOutputText outputText8 = new HtmlOutputText();
    public HtmlOutputText getOutputText8() {
    return outputText8;
    public void setOutputText8(HtmlOutputText hot) {
    this.outputText8 = hot;
    private HtmlOutputText outputText9 = new HtmlOutputText();
    public HtmlOutputText getOutputText9() {
    return outputText9;
    public void setOutputText9(HtmlOutputText hot) {
    this.outputText9 = hot;
    public UIInput textField1 = new UIInput();
    public UIInput getTextField1() {
    return textField1;
    public void setTextField1(UIInput hit) {
    this.textField1 = hit;
    public UIInput textField2 = new UIInput();
    public UIInput getTextField2() {
    return textField2;
    public void setTextField2(UIInput hit) {
    this.textField2 = hit;
    public UISelectBoolean checkbox1 = new UISelectBoolean();
    public UISelectBoolean getCheckbox1() {
    return checkbox1;
    public void setCheckbox1(UISelectBoolean hsbc) {
    this.checkbox1 = hsbc;
    public String save_action() {
    try{
    java.lang.System.out.println("<<<<<<<<<<<<<<<Button Came<<<<<<<<<<<<<<<<<<>>>>>>>");
    java.lang.System.out.println("====================Welcome to the Button action======================");
    int firstIndex = uiTable2.getFirst();
    int rows = uiTable2.getRowCount();
    java.lang.System.out.println("----------------------FIRST INDEX-----------------------"+firstIndex);
    java.lang.System.out.println("----------------------ROWS-----------------------"+rows);
    ArrayList orderAttribs = orderCat.getAttributes();
    Iterator it = orderAttribs.iterator();
    while(it.hasNext())
    OrderAttribute currentAttribute = (OrderAttribute) it.next();
    java.lang.System.out.println("==================String Value===================" + currentAttribute.getCheckbox1());
    java.lang.System.out.println("==================String Value===================" + currentAttribute.getName());
    java.lang.System.out.println("==================String Value===================" + currentAttribute.getDefaultMin());
    java.lang.System.out.println("==================String Value===================" + currentAttribute.getDefaultMax());
    catch (Exception e) {
    e.printStackTrace();
    return "Test";
    private HtmlCommandButton save = new HtmlCommandButton();
    public HtmlCommandButton getSave() {
    return save;
    public void setSave(HtmlCommandButton hcb) {
    this.save = hcb;
    Please Reply me with this solution soon.............
    Thanx,
    Sidharth
    }

    you may get some help in the following...
    http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/inserts_updates_deletes.html
    -Regards,
    Aniruddha

  • Datatable problem

    Hi,
    iam using jsf with myfaces.iam using datatable for searching and listing.
    iam setting a new search list to a datatable..In search method iam adding a list to a datatable like getDatatable().setValue(searchedList) and for listing iam using another list.so the datatable not getting reset.
    After search iam trying to new record into a database that record is successfully adding to a database but that record is not getting update into datatable.its showing previous list.this problem comes only after using search because iam setting a new list into datatable.so how can i overcome this problem.without search its working fine.since two days iam working on this problem.iam gooogled but no use .So plz suggest me
    any help with great appreciation
    protected HtmlDataTable dataTable = null;
    this datatable for searching and listing.
    My Jsp is:
    <t:dataTable id="fundData" value="#{fundingBean.fundingList}"
    styleClass="headStyle" var="funding" rows="10" width="70%" headerClass="headerStyle"
    binding="#{fundingBean.dataTable}" cellpadding="2" cellspacing="0"
    style="border-collapse: collapse; border-right: 2px solid #1b9fab;border-left: 2px solid #1b9fab;
    border-bottom: 2px solid #1b9fab;text-align:left;">
    <h:column>
    <f:facet name="header">
    <h:outputText value="#{msgs.serialno}" styleClass="data-Headingtext" />
    </f:facet>
    <h:outputText value="#{fundingBean.dataTable.rowIndex + 1}" />
    </h:column>
    <h:column>
    <f:facet name="header">
    <h:outputText value="#{msgs.accID}" styleClass="data-Headingtext" />
    </f:facet>
    <h:outputText value="#{funding.accountID}" />
    </h:column>
    <h:column>
    <f:facet name="header">
    <h:outputText value="#{msgs.fundingID}" styleClass="data-Headingtext" />
    </f:facet>
    <h:outputText value="#{funding.ID}" />
    </h:column>
    <h:column>
    <f:facet name="header">
    <h:outputText value="#{msgs.fundingType}" styleClass="data-Headingtext" />
    </f:facet>
    <h:outputText value="#{funding.type}" />
    </h:column>
    <h:column>
    <f:facet name="header">
    <h:outputText value="#{msgs.amount}" styleClass="data-Headingtext" />
    </f:facet>
    <h:outputText value="#{funding.amount}" />
    </h:column>
    <%--<h:column>
    <f:facet name="header">
    <h:outputText value="#{msgs.transType}" styleClass="data-Headingtext" />
    </f:facet>
    <h:outputText value="#{funding.transactionType}" />
    </h:column>--%>
    <h:column>
    <f:facet name="header">
    <h:outputText value="#{msgs.naration}" styleClass="data-Headingtext" />
    </f:facet>
    <t:popup closePopupOnExitingElement="true"
    closePopupOnExitingPopup="true" displayAtDistanceX="0"
    displayAtDistanceY="0">
    <h:outputText value="#{funding.narration}">
    <s:convertStringUtils trim="true" maxLength="5"
    appendEllipsesDuringOutput="true" />
    </h:outputText>
    <f:facet name="popup">
    <h:panelGrid columns="1">
    <h:outputText value="#{funding.narration}" styleClass="errorMessage" />
    </h:panelGrid>
    </f:facet>
    </t:popup>
    </h:column>
    <h:column>
    <h:commandLink id="fundingDetails" value="Detail"
    actionListener="#{fundingBean.fundingDetails}" />
    </h:column>
    </t:dataTable>
    this Displays list from database.
    Below code writen insame jsp which is used for searching:
    <h:panelGrid columns="5">
    <h:column>
    <h:selectOneMenu id="searchCombo" value="#{fundingBean.searchKey}" styleClass="headStyle">
    <f:selectItem itemValue="Account No" itemLabel="Account No" />
    <f:selectItem itemValue="Funding ID" itemLabel="Funding ID" />
    </h:selectOneMenu>
    </h:column>
    <h:column>
    <h:inputText id="searchText" value="#{fundingBean.searchValue}" styleClass="headStyle" />
    </h:column>
    <h:column>
    <h:commandButton id="go" alt="press to search " styleClass="headStyle"
    value="#{msgs.jspGOButton}" action="#{fundingBean.search}" />
    </h:column>
    <h:column>
    <h:commandButton id="show" alt="press to search " value="#{msgs.jspShowAll}"
    action="#{fundingBean.showAllFundingList}" styleClass="headStyle"
    onclick="clearSearchText" />
    </h:column>
    and my backing bean is :
    This code displays the list
    public List getFundingList() throws RemoteException {
    FundingDTO fundDTO = new FundingDTO();
    fundList = new ArrayList();
    RMILookup lookup = RMILookup.getInstance();
    Fund fund = (Fund) lookup.invokeMethod(objectName);
    list = fund.getFundList();
    Iterator itr = list.iterator();
    while(itr.hasNext()){
    fundDTO = (FundingDTO) itr.next();
    FundingMode fundingMode = fundDTO.getTransactionType();
    String mode = fundingMode.toString();
    String fundType = fundDTO.getType().toString();
    if( fundType!= "Coupon" && (mode.equals("Insert")||mode.equals("Update")))
    fundList.add(fundDTO);
    return fundList;
    and below code for searching:
    public void search(){
    //getSearchDataTable().setRendered(true);
    //this.getDataTable().setRendered(false);
    FacesContext context = FacesContext.getCurrentInstance();
    FacesMessage message = new FacesMessage();
    List fundingSearchList = new ArrayList();
    List cpnList = new ArrayList();
    FundingDTO fundingdDTO = null;
    if(searchValue.equals("")){
    message.setSeverity(FacesMessage.SEVERITY_ERROR);
    message.setDetail("Please chose search value");
    context.addMessage(null, message);
    return;
    if (searchKey.equalsIgnoreCase(configuration.getProperty(search1))){
    String accountID = util.addZeroPrefix(searchValue);
    for (int i=0; i < list.size();i++){
    fundingdDTO =(FundingDTO)list.get(i);
    if(fundingdDTO.getType().toString()!= "Coupon" && fundingdDTO.getAccountID().equalsIgnoreCase(accountID)){
    fundingSearchList.add(fundingdDTO);
    continue;
    else if(fundingdDTO.getAccountID().equalsIgnoreCase(accountID) &&
    fundingdDTO.getType().toString().equalsIgnoreCase("coupon")){
    cpnList.add(fundingdDTO);
    continue;
    }else if(searchKey.equalsIgnoreCase(configuration.getProperty(search2))){
    String id =util.addZeroPrefix(searchValue);
    for(int i=0;i < list.size(); i++){
    fundingdDTO = (FundingDTO)list.get(i);
    if(fundingdDTO.getType().toString()!="Coupon" && fundingdDTO.getID().equalsIgnoreCase(id)){
    fundingSearchList.add(fundingdDTO);
    continue;
    else if(fundingdDTO.getType().toString().equalsIgnoreCase("coupon") && fundingdDTO.getID().equalsIgnoreCase(id)){
    cpnList.add(fundingdDTO);
    continue;
    else if (searchKey.equalsIgnoreCase(configuration.getProperty(search3))){
    for (int i=0; i < couponList.size();i++){
    fundingdDTO =(FundingDTO)couponList.get(i);
    if (fundingdDTO.getCouponExpiryDate().toString().equalsIgnoreCase(searchValue)){
    cpnList.add(fundingdDTO);
    break;
    else {
    logger.log(this.getClass().getName(), "invalid search key passed", LoggerConstants.INFO, null);
    this.getDataTable().setValue(fundingSearchList);
    and this one for showAll list:
    public void showAllFundingList() throws RemoteException{
    this.getDataTable().setValue(fundList);
    iam using same datarable searching and listing thats why datatable not getting update i think

    First of all thanks for u r reply
    Following jsp displays the datatable list from database
    <t:dataTable id="fundData" value="#{fundingBean.fundingList}"
                                  styleClass="headStyle" var="funding" rows="10" width="70%" headerClass="headerStyle"
                                  binding="#{fundingBean.dataTable}" cellpadding="2" cellspacing="0"
                                  style="border-collapse: collapse; border-right: 2px solid #1b9fab;border-left: 2px solid #1b9fab;
                                  border-bottom: 2px solid #1b9fab;text-align:left;"
                                  preserveDataModel="false">and the method which displays list from backing bean is
    public List getFundingList() throws RemoteException {
              FundingDTO fundDTO = new FundingDTO();
              fundList = new ArrayList();
              RMILookup lookup = RMILookup.getInstance();
              Fund fund = (Fund) lookup.invokeMethod(objectName);
              list = fund.getFundList();
              Iterator itr = list.iterator();
              while(itr.hasNext()){
                   fundDTO = (FundingDTO) itr.next();          
                   FundingMode fundingMode = fundDTO.getTransactionType();
                   String mode = fundingMode.toString();
                   String fundType = fundDTO.getType().toString();
                   if( fundType!= "Coupon" && (mode.equals("Insert")||mode.equals("Update")))
                        fundList.add(fundDTO);
              return fundList;
         }and in the same jsp page added three command buttons
    one for search the datatable by id and another for show all list and other button is for invokes the popup (this popup is contains) various field it is used for add new record into the funding.and close the popup window and refresh the parent window
    <h:column>
                                  <h:commandButton id="go" alt="press to search " styleClass="headStyle"
                                       value="#{msgs.jspGOButton}" action="#{fundingBean.search}">
                                  </h:commandButton>     
                             </h:column>
                             <h:column>
                                  <h:commandButton id="show" alt="press to search " value="#{msgs.jspShowAll}"
                                       action="#{fundingBean.showAllFundingList}" styleClass="headStyle"
                                       onclick="clearSearchText" />
                             </h:column>
    <h:column>
                                  <h:commandButton value="Add New" onclick="doPopup(this);return false;"
                                       style="margin-left: 3px;" styleClass="headStyle" />
                             </h:column>From Backing bean the method for search
    public void showAllFundingList() throws RemoteException{
              getDataTable().setValue(fundList);
    If iam not use search this code works fine.If iam use search the page not getting refresh.Here iam thinking problem is that iam setting
    From search methodgetDatatable.setValue(fundingSearchList);
    and form showFunding methodgetDatatable.setValue(fundList);
    this is code related to searching add record into funding
    thanks                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Datatable problems...

    Hi,
    I would like to create a page on which a datatable is filled, based on the result of a database query. I've tried this in several ways. The one that got me closest to a solution was the tutorial at: http://www.oracle.com/technology/oramag/oracle/06-jan/o16jsf.html
    I want to use this to create a forum. The page I'm creating now is the page that lists the threads.
    The code from the tutorial gave the HTML output:
    <table>
    <tr>
    <td></td>
    <td></td>
    <td></td>
    <td></td>
    </tr>
    </table>
    Since there were 4 threads in the datbase at the time, this is correct, but for some reason the threadnames don't appear. Anybody any ideas as to why this happens?
    Also, if there are better solutions for this problem than using a datatable, I'll be glad to hear them :)

    Ok, nvm...
    Found the solution myself.
    If anyone should encounter the same problems, try the tutorial at: http://balusc.xs4all.nl/srv/dev-jep-dat.html
    Worked perfectly for me.

  • Help: commandLink does not work.

    commandLink does not work. It just simple refreshes the page, and not enter the Listener,( he listener work pretty well in other page).
    Is it dataTable problem? If I not use dataTable but just use JSTL & JSF commandLink and it works fine.
    --------------CODE---------------
    <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%>
    <%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
    <link rel="stylesheet" type="text/css" href='<%= request.getContextPath() + "/style/styletable.css"%>'/>
    <f:loadBundle basename="bundle.admin.Attribute" var="bdlAttribute"/>
    <f:subview id="AttributeListView">
    <h:form id="AttributeListForm">
    <center>
    <h:outputText escape="false" value="Text Here"/>
    <br>
    <h:dataTable id="AttributeTable"
    columnClasses="list-column-center,list-column-right, list-column-center, list-column-right"
    headerClass="list-header"
    rowClasses="list-row"
    styleClass="list-background"
    value="#{list}"
    var="attribute">
    <f:facet name="header">
    <h:outputText value="#{bdlAttribute.TitleList}"/>
    </f:facet>
    <h:column>
    <f:facet name="header">
    <h:outputText value="#{bdlAttribute.Category}"/>
    </f:facet>
    <h:outputText id="category" value="#{attribute.category}"/>
    </h:column>
    <h:column>
    <f:facet name="header">
    <h:outputText value="#{bdlAttribute.Value}"/>
    </f:facet>
    <h:outputText id="value"
    value="#{attribute.value}"/>
    </h:column>
    <h:column>
    <f:facet name="header">
    <h:outputText value="#{bdlAttribute.DataType}"/>
    </f:facet>
    <h:outputText id="dataType" value="#{attribute.dataType}">
    </h:outputText>
    </h:column>
    <h:column>
    <f:facet name="header">
    <h:outputText value="#{bdlAttribute.Edit}" />
    </f:facet>
              <h:commandLink action="#{Action.action}" styleClass="link">
                   <f:actionListener type="my.AttributeListener"/>
                   <h:outputText value="Edit"/>
                   <f:param name="ID" value="#{attribute.attributeId}"/>
                   <f:attribute name="COMMAND" value="getAttribute"/>
              </h:commandLink>
    </h:column>
    <h:column>
    <f:facet name="header">
    <h:outputText value="#{bdlAttribute.Delete}"/>
    </f:facet>
         <h:commandLink action="#{Action.action}" styleClass="link">
              <f:actionListener type="my.AttributeListener"/>
              <h:outputText value="Delete"/>
              <f:param name="ID" value="#{attribute.attributeId}"/>
              <f:attribute name="COMMAND" value="deleteAttribute"/>
         </h:commandLink>
    </h:column>
    </h:dataTable>
    <h:messages styleClass="validationMessage"/>
    </center>
    </h:form>
    </f:subview>

    Hi,
    I was casually reading your code and noticed the line:'
    <h:commandLink action="#{Action.action}" styleClass="link">
    I recall from other posts that if you want the method on the bean (of the clicked/ selected row) to be called, you probably need:
    <h:commandLink action="#{attribute.action}" styleClass="link">
    Ofcourse you would need to have a method called action in the class of instance "attribute". This method should return string for navigation etc.
    Looking at your code again:
    <h:commandLink action="#{Action.action}" styleClass="link">
    <f:actionListener type="my.AttributeListener"/>
    <h:outputText value="Delete"/>
    <f:param name="ID" value="#{attribute.attributeId}"/>
    <f:attribute name="COMMAND" value="deleteAttribute"/>
    </h:commandLink>
    I don't understand why you need:
    <f:actionListener type="my.AttributeListener"/>
    As I am not coding a lot of JSF I am only answering from what I have read.
    All the best,
    Vinay

  • How about some New Forums for JSC?

    I read somewhere that the JSC forum is Sun's highest activity forum. The trouble is, there's a lot of information mixed together.
    Would it be possible to create several forums (or subforums) for JSC? Here's some I'd suggest:
    Help: newbie requests for JSC help (like how do I create a datatable)
    Problems: place to ask for help with technical problems, like DB connectivity, use with a given server, installation problems, etc.
    Bugs: Bugs, deficiencies and workarounds
    Examples/Solutions: place to show nifty tricks that have been found, or how to do something complicated.
    Suggestions: Suggestions for the JSC team
    General: Other stuff not covered above.
    IMHO, breaking the forum into these logical groups would make the forum much more useful. Perhaps the categories above aren't perfect or complete. However, something in this direction would be good.

    In a perfect world, the topics would be sorted into forums. However, these could be left in general, and start with the new categories empty. At least new discussion would be more organized.
    It would also be extremely helpful to move old, obsolete topics to somewhere else, or delete them. I don't now how many times I've begun reading a post only to find it applies to an earlier version of creator, and since then the bug, problem or whatever has been fixed anyway.

  • Design problem with dynamically added row in datatable

    Hello all,
    I have a dataTable and have developped a method that dynamically adds rows to the dataTable. Each row is made up of two form controls. The problem I have now is that I don't know how to retrieve the values from the mutiple rows. Ideally I would need the values to be stored into a list.
    Can anyone help?
    Thanks in advance,
    Julien.
    Here is my code:
    <h:dataTable var="line" binding="#{TradeClientsAndQuantitiesBean.clientsAndQuantities}"  value="#{TradeClientsAndQuantitiesBean.listOfMiddleFormHelpers}">
                <h:column>
                    <f:facet name="header">
                        <h:outputText value="S�lectionnez un client"/>
                    </f:facet>
                    <h:selectOneMenu value="#{TradeClientsAndQuantitiesHelperBean.selectedClientTemp}">
                        <f:selectItems value="#{TradeClientsAndQuantitiesHelperBean.concatenatedLabelMap}"/>
                    </h:selectOneMenu>
                </h:column>   
                <h:column>
                    <f:facet name="header">
                        <h:outputText value="Renseignez une quantit�"/>
                    </f:facet>
                    <h:inputText value=""/>
                </h:column>   
            </h:dataTable>

    The values will just be put in the same row object you added to TradeClientsAndQuantitiesBean.listOfMiddleFormHelpers.
    It might be worth to read this article: http://balusc.xs4all.nl/srv/dev-jep-dat.html

  • Problem with binding in h:dataTable

    Hi
    I have a problem with h:dataTable, where the table rows are bound to objects (Bean$Line) nested within a backing bean (Bean).
    JSP:
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
    <%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
    <html>
      <f:view>
        <head>
          <link href="styles.css" rel="stylesheet" type="text/css"/>
          <title>Sandbox</title>
        </head>
        <body>
          <h:form>
            <h:dataTable value="#{bean.lines}" var="line">
              <h:column>
                <h:outputText value="#{line.id}"/>
              </h:column>
              <h:column>
                <!-- using value = line.lineSelected here works (assuming boolean property Line.lineSelected) --/>
                <h:selectBooleanCheckbox binding="#{line.lineSelected}"/>
              </h:column>
            </h:dataTable>
          </h:form>
        </body>
      </f:view>
    </html>Bean:
    package com.test;
    import java.util.ArrayList;
    import java.util.List;
    import javax.faces.component.UISelectBoolean;
    public final class Bean {
      private final List<Line> lines;
      public Bean() {
        lines = new ArrayList<Line>();
        lines.add(new Line("one"));
        lines.add(new Line("two"));
        lines.add(new Line("three"));
      public List<Line> getLines() {
        return lines;
       * Nested class in order to access containing class
       * properties etc.
      public static class Line {
        //private boolean lineSelected = false;
        private UISelectBoolean lineSelected;
        private String id;
        public Line(String id) {
          this.id = id;
        /*public boolean isLineSelected() {
          return lineSelected;
        public void setLineSelected(boolean lineSelected) {
          this.lineSelected = lineSelected;
        public UISelectBoolean getLineSelected() {
          return lineSelected;
        public void setLineSelected(UISelectBoolean lineSelected) {
          this.lineSelected = lineSelected;
        public String getId() {
          return id;
        public void setId(String id) {
          this.id = id;
      } // Line
    }The setup works when I use value="#{line.lineSelected}" (assuming the property is defined as boolean in Bean$Line) but as soon as I use a binding, I get the following exception:
    com.sun.rave.web.ui.appbase.ApplicationException: javax.servlet.ServletException: javax.el.PropertyNotFoundException: Target Unreachable, identifier 'line' resolved to null
    at com.sun.rave.web.ui.appbase.faces.ViewHandlerImpl.cleanup(ViewHandlerImpl.java:594)
    at com.sun.rave.web.ui.appbase.faces.ViewHandlerImpl.renderView(ViewHandlerImpl.java:325)
    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
    at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
    at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:317)
    faces_config:
    <faces-config version="1.2"
                  xmlns="http://java.sun.com/xml/ns/javaee"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
      <application>
        <locale-config>
          <default-locale>en_GB</default-locale>
          <supported-locale>en_GB</supported-locale>     
        </locale-config>
      </application>
      <managed-bean>
        <managed-bean-name>bean</managed-bean-name>
        <managed-bean-class>com.test.Bean</managed-bean-class>
        <managed-bean-scope>session</managed-bean-scope>
      </managed-bean>
    </faces-config>What am I missing here?
    Help much appreciated
    Lance

    Guys
    Thanks a lot, both of your replies are immensely instructive. Maybe a little background on what I'm trying to do. In the table, I have header rows with dependent line rows. When a check box is ticked in the header, I want the corresponding check boxes in the dependent lines to be checked automatically (in slave fashion and ideally without using JavaScript). My idea was to update the bound components (for the lines) from within the Bean (in response to change on the header). However, given there's only a single component for each column in the table, this of course doesn't make sense.
    I'm trying to get to the typical MVC workflow of a) user updates a View component, b) Controller detects the change and updates the Model, c) The Model fires a property change event, which the View detects and updates appropriately. What's the way to achieve this in JSF (by design)?
    Here's a simple fragment (which does not work):
            <h:dataTable value="#{bean.lines}" var="line">
              <h:column>
                <h:outputText value="#{line.id}"/>
              </h:column>
              <h:column>
                <!-- (1) This is the master and (2) should refresh on update here --/>
                <h:selectBooleanCheckbox onchange="submit()" value="#{line.lineSelected}"/>
              </h:column>
              <h:column>
                <!-- (2) This is the slave and I want this to update in response to a change of (1) above --/>
                <h:selectBooleanCheckbox value="#{line.slaveSelected}"/>
              </h:column>
            </h:dataTable>In the setter method for lineSelected, I'm setting slaveSelected to the new value but the View is not refreshing based on this. How do I get the View to update (each dependent line) based on the new values for slaveSelected?
    Thanks again
    Lance

  • Problem with commandButton in a custom DataTable

    I am trying to write a cutom DataTable and am having some trouble. I don't think that the DataTable that gets shipped has the flexibility that we need for our pages. That's why I'm trying to write my own.
    What I have is a commandButton in one of the column headers for the table. It is bound to a method in a backing bean. The page seems to render correctly. But when I click on the button, it seems to make a trip to the server, but the method doesn't get invoked.
    I figure that I'm missing something in my custom component, but I just can't figure it out. Does anyone have any ideas?
    If you would like for me to post some/all of the code just let me know. I didn't what might be helpful.
    Thanks,
    Ray

    Thank you for your response.
    I already had a messages tag on my page and no messages come out. I've looked in the log and don't see anything in their either. I put in a phaseListener and all of the phases are being processed.
    Here is my output. It is the same whether I press the button that is inside my custom dataTable or press a button that is outside my custom dataTable.
    beforePhase RESTORE_VIEW 1
    afterPhase RESTORE_VIEW 1
    beforePhase APPLY_REQUEST_VALUES 2
    afterPhase APPLY_REQUEST_VALUES 2
    beforePhase PROCESS_VALIDATIONS 3
    afterPhase PROCESS_VALIDATIONS 3
    beforePhase UPDATE_MODEL_VALUES 4
    afterPhase UPDATE_MODEL_VALUES 4
    beforePhase INVOKE_APPLICATION 5
    afterPhase INVOKE_APPLICATION 5
    beforePhase RENDER_RESPONSE 6
    afterPhase RENDER_RESPONSE 6
    The problem is, when I press the button that is inside my custom dataTable the method for the button doesn't get invoked. So I believe that I have something wrong in my custom dataTable that isn't building the component tree correctly. Does anyone have any ideas for this?
    Here is the class that renders my col tag. That tag puts out the <th> that the button is in.
    * Created on Dec 19, 2004
    package com.monsanto.ag_it.fieldops.aim.tblmaint.renderer;
    import java.io.IOException;
    import javax.faces.component.UIComponent;
    import javax.faces.context.FacesContext;
    import javax.faces.context.ResponseWriter;
    import javax.faces.render.Renderer;
    import com.monsanto.ag_it.fieldops.aim.tblmaint.component.UIRptTableCol;
    import com.monsanto.ag_it.fieldops.aim.tblmaint.component.UIRptTableColHdr;
    * @author rcclark
    * Renderer for the RptTableTag
    public class RptTableColRenderer extends Renderer {
         private String tagType = null;
         public void encodeBegin(FacesContext context, UIComponent rptTableCol)
                   throws IOException {
              // First determine if this is a th or td cell
              Object rptTblSection = rptTableCol.getParent().getParent();
              tagType = "td";
              if (rptTblSection instanceof UIRptTableColHdr) {
                   tagType = "th";
              ResponseWriter writer = context.getResponseWriter();
              UIRptTableCol rptTblCol = (UIRptTableCol) rptTableCol;
              writer.write("\t\t\t");
              writer.startElement(tagType, rptTableCol);
    //System.out.println("col id=" + (String) rptTableCol.getAttributes().get("id"));
    //          if (!rptTblCol.getId().substring(0, 3).equals("_id")) {
                   writer.writeAttribute("id", rptTblCol.getClientId(context), null);
              String colClass = (String) rptTableCol.getAttributes().get("colClass");
              if (colClass != null) {
                   writer.writeAttribute("class", colClass, null);
              String colSpan = (String) rptTableCol.getAttributes().get("colSpan");
              if (colSpan != null) {
                   writer.writeAttribute("colSpan", colSpan, null);
              String rowSpan = (String) rptTableCol.getAttributes().get("rowSpan");
              if (rowSpan != null) {
                   writer.writeAttribute("rowSpan", rowSpan, null);
         public void encodeEnd(FacesContext context, UIComponent rptTableCol)
                   throws IOException {
              ResponseWriter writer = context.getResponseWriter();
              writer.endElement(tagType);
              writer.write("\r\n");
         public boolean getRendersChildren() {
              return true;
    }Thanks,
    Ray

  • Problem with selectOneMenu in Datatable

    Hi
    I have the following datatable that binds correctly to a set of Game objects.
    I need to have a dropdown with the numbers 1 to 10 as items which is bound to each dataItem's newRating field.
    However there is some problem with the dropdown that i can't figure out. The datatable stops rendering when it hits the first dropdown.
    At the moment,
    The new rating field in the Game class is of type SelectItem with the appropriate get and set methods.
    Could anyone please point out what I'm doing wrong
    Thanks.
    Here is the relevant part in Home.jsp:
                                              <h:dataTable binding="#{Home.newGamesTable}" id="newGamesTable" value="#{Home.newGames}" var="dataItem">
                                                                <h:column>
                                                                    <f:facet name="header">
                                                                        <h:outputText value=""/>
                                                                    </f:facet>
                                                                    <h:panelGroup layout="block" styleClass="new_game_main">
                                                                        <h:outputText styleClass="new_game_title" value="#{dataItem.title}"/>
                                                                        <h:outputText escape="false" styleClass="new_game_label" value="Date added: "/>
                                                                        <h:outputText styleClass="new_game_data" value="#{dataItem.dateString}"/>
                                                                        <h:outputText escape="false" styleClass="new_game_label" value="Average Rating:"/>
                                                                        <h:outputText styleClass="new_game_data" value="#{dataItem.rating}"/>
                                                                        <h:outputText styleClass="new_game_label" value="Uploaded by:"/>
                                                                        <h:outputText styleClass="new_game_data" value="#{dataItem.userName}"/>
                                                                        <h:commandLink styleClass="new_game_label" value="Play Now!"/>
                                                                        <h:selectOneMenu styleClass="new_game_rating" value="#{dataItem.newRating}">
                                                                            <f:selectItems value="#{ratingItems}" />
                                                                        </h:selectOneMenu>
                                                                        <h:commandLink action="#{Home.rateNewGame}" styleClass="message_link" value="Rate"/>
                                                                    </h:panelGroup>
                                                                </h:column>
                                                            </h:dataTable>and Home.java
    private List<SelectItem> ratingItems = null;
         public List<SelectItem> getRatingItems()
             if (ratingItems == null)
                 ratingItems = new ArrayList<SelectItem>();
                 for (int i = 1; i <= 10; i++)
                     SelectItem item = new SelectItem();
                     item.setValue(Integer.valueOf(i));                        
                     ratingItems.add(item);
             return ratingItems;
         public void setRatingItems(List<SelectItem> items)
             ratingItems = items;        
        private List<Game> newGames = null;
        private boolean hasNewGames;
        public List<Game> getNewGames()
            if (newGames ==null)
                newGames = DataFactory.getNewGames();           
            hasNewGames = !newGames.isEmpty();
            return newGames;
        }

    What do you mean by stops rendering? Can you paste the relevant portion of the output (from view source in the browser).

  • Problem with h:dataTable and binding attribute

    I am new to JSF and I have a problem using the binding attribute of h:dataTable.
    I can successfully use the value attribute to display rows of data fetched from an Oracle database into h:dataTable, but I do know how to bind a h:dataTable to a server object which I would use to update the changes made in the h:dataTable.
    Can some body show me an example how to do so ?
    Thanks in advance.

    I'm not sure whether i understand your problem,
    It doesnot need using the binding attribute If you wanna updating the value of each rows in the datatable.
    below is a sample that updating each rows of a datatable
    jsp file
    <h:dataTable value="#[sampleBean.data}" var="row">
        <h:column><h:inputText value="#{row.col1}"/></h:column>
    </h:dataTable>
    <h:commandButton value="update" action="#{sampleBean.update}"/>BackingBean:
    SampleBean.java
    public class Samplebean{
      private SampleRow[] rows[];
      public SampleRow[] getData{
              return rows;
      public String update(){
          for(int i=0; i<rows.length; i++){
             rows.update();
    return "success";
    SampleRow.java
    public class SampleRow{
      private String col1;
      public String getCol1(){
        return col1;
      public void setCol1(String col1){
        this.col1 = col1;
      public void update(){
         //write your code to save one row data to db/file here

  • Problem with binding of a selectManyCheckbox inside a dataTable

    Hi,
    first i want to point out that my english is not the best. :)
    A german version is followed at the end of the english text.
    I have a class "MyClass" with few attributes like:
    private long id;
    private String text;
    private Set<MyClass2> childs;
    An a second class "MyClass2" wich also have some attributes:
    private long id;
    private String text;
    Now i have a List with lots of objects from typ "MyClass":
    List myList = new ArrayList();
    // Sample Data!!
    for (int i=0; i<100; i++)
    MyClass1 m1 = new MyClass1();
    m1.setId(i);
    m1.setText("MyClass1 Line " + i);
    // Now add some "childs":
    for (int j=0; j<i*2; j++)
    MyClass2 m2 = new MyClass2();
    m2.setId( i );
    m2.setText("Sample "+ i);
    m1.getChilds().add(m2);
    myList.add ( m1 );
    So now i want to show the ID and text every Object of MyClass1 on my "test.jsp" (width JSF Tags).
    The Collections inside this class should display as checkboxes (value = id, label = text).
    Sample:
    ID: +1+ TEXT: MyClass1 Line 1
    CHECKBOXES:
    [x] Sample 0
    [x] Sample 1
    ID: +2+ TEXT: MyClass1 Line 2
    CHECKBOXES:
    [x] Sample 0
    [x] Sample 1
    [x] Sample 2
    [x] Sample 3
    Okay i think you know what i mean. ;-)
    I tryed it also with a dataTable to iterate in "myList" and use a selectOneMenu with selectItems to generate the checkboxes.
    Here is the code:
    <h:dataTable value="#{myBean.myList}" var="rowInstance" binding="#{myBean.dataTable}" id="dataTable">
    <h:column>
    <h:outputText value="ID: #{rowInstance.id}" />
    <h:outputText value="TEXT: #{rowInstance.text}" />
    </h:column>
    <h:column>
    <h:selectManyCheckbox id="cbox" styleClass="checkbox">
    <f:selectItems value="#{myBean.childs}"/>
    </h:selectManyCheckbox>
    </h:column>
    </h:dataTable>
    Maybe you see the that i've used childs in the selectItems.
    This is a methode like that:
    public SelectItem[] getChilds()
    MyClass1 mc1 = (MyClass1) dataTable.getRowData();
    // now i iterate the childs and make for each a SelectItem()
    Also you maybe see that i have no binding on selectManyCheckbox, because i have no idea how it works. :-)
    I've tried to bind it to a String[] but and the end this String[] always contain the last low.
    My Question is now:
    When the user pressed the submit Button how can i figure out which Checkboxen the user clicked ?
    Thank you a lot.
    Now the german version (surley better explained):
    Hallo nochmal,
    ich habe versucht auf englisch mein Problem zu schildern.
    Was mit sicherheit nicht zu 100% gelungen ist, deshalb hier noch mal eine deutschsprachige Version (maybe some germans out there).
    Wie oben abgeblidet habe ich im Prinzip zwei Klassen.
    Die erste Klasse "MyClass1" hat eine Collection die Objekte von der Klasse "MyClass2" enth�lt.
    Nun m�chte ich auf meiner JSP Seite die JSF Tags benutzt eine Liste von Objekten (die vom Typ "MyClass1" sind) abbilden.
    Die Collection innerhalb dieser Klasse soll als Checkboxen dargestellt werden.
    Ich habe es ohne gro�e Probleme hinbekommen, dass er das so anzeigt wie ich das m�chte.
    Nur habe ich z.Z. noch Probleme damit wie ich sp�ter herausfinde, welche der Checkboxen denn nun angew�hlt sind.
    Normalerweise w�rde man ja ein binding machen, so k�nnte man alle ausgew�hlten Checkboxen (getSelectedValues()) ja bekommen.
    Da aber die Anzahl der Objekte immer unterschiedlich ist kann ich nicht die entsprechenden Variablen anlegen.
    Deshalb die Frage: Wie bekomme ich mit welche der Checkboxen ausgew�hlt wurden? Wie muss das binding aussehen?
    Vielen Dank.
    Greetings from Germany. :)

    Just bind it to the row object.
    JSF<h:dataTable value="#{myBean.myDataList}" var="myData">
        <h:column>
            <h:selectManyCheckbox value="#{myData.selectedItems}">
                <f:selectItems value="#{myData.selectItems}" />
            </h:selectManyCheckbox>
        </h:column>
    </h:dataTable>MyDataprivate List<String> selectedItems; // + getter + setter
    private List<SelectItem> selectItems; // + getter

  • h:dataTable re-rendering problem...

    hi friends,
    In my project i am using JSF and a4j .I am getting re-rendering problem with <h:dataTable> in mozilla it is working fine but in IE6 the dataTable is not re-rendering ..
    code is:
    <a4j:commandButton value="#{rb.New}" onmouseup="javascript:openModalWindow('/NGL/faces/jsp/circulation /ILLPlaceILLRequest.jsp','','dialogWidth:500px;dialogHeight:500px;status:no;scrollbars:yes;top:200;left:200')" >
    <a4j:support event="onmousedown" action="#{requestApprove.newActionPerformed}"/>
    <a4j:support event="oncomplete" reRender="illDetails"/>
    </a4j:commandButton>
    my task is:
    when i press the New button another jsp page will open in modal dialog after closing the dialog the table should re-render...
    Edited by: Venkat_quill on Oct 30, 2008 3:29 AM
    Edited by: Venkat_quill on Oct 30, 2008 3:50 AM

    thanks for your reply...
    I have already tried this case but, the datatable is not re-rendering ...
    I got below solutions..
       <a4j:commandButton value="#{rb.New}" onmouseup="javascript:openModalWindow('/NGL/faces/jsp/circulation  /ILLPlaceILLRequest.jsp','','dialogWidth:500px;dialogHeight:500px;status:no;scrollbars:yes;top:200;left:200')" >
                                    <a4j:support event="onmousedown" action="#{requestApprove.newActionPerformed}"/>
                                    <a4j:support event="oncomplete" action="#{requestApprove.clearData}" reRender="illDetails"/>
    </a4j:commandButton>Why i followed this case this i have Add,Edit ,Delete and Refresh action on datatable.In Edit case i need to set some values in the dialog this also working fine with following code..
    <a4j:commandButton value="#{rb.Edit}" onmouseup="editRequest()">
         <a4j:support event="onmousedown" action="#{requestApprove.editActionPerformed}" reRender="msg,msgmode"/>
        <a4j:support event="oncomplete" action="#{requestApprove.clearData}" reRender="illDetails,msg,msgmode"/>
    </a4j:commandButton>But this problem is oncomplete event is not working in the Internet Explorer....

Maybe you are looking for

  • 3.1.2 updated now songs and apps don't work...please help

    I have an ipod touch that was given to me for my birthday a couple of years ago, I've never had any real problems with it untill now: Last night I bought the 3.1.2 update as some of my recently updated apps are unusable without it. I believe this is

  • Unable to connect to Android Device with MAC

    Hi I have been trying to connect to my device ( Samsung Galaxy S4) with Edge Inspector but it literaly does nothing except to stand still on "waiting for a connection" on Chrome, wait on the WIFI Name + Loading circle on my device, crashing (unfortun

  • Question abount custom security in WL 7.0

    Hello, We want to be able to: 1) Authenticate users using a custom realm 2) Authorize users using the built in LDAP provider. We do not want to run in compatibility mode. Could someone please tell us what needs to be done ? We think that we have to w

  • Disabled button after redirect

    I have created a page with a region button on it. The button has a redirect to a URL which runs a pl/sql procedure. After clicking the button, the procedure runs and I see my original page, but, the button is disabled. When I look at the page source,

  • Campus lan with 6500

    Hi At the moment we plan a new network with 2 6506 and sup720. I am not shure if hsrp is enough or better to use eigrp. Or does somebody has another idea