You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Katareek <ka...@vp.pl> on 2005/11/22 09:32:07 UTC

t:dataTable problem

Hi,

I have problem with dataTable. When I invoke jsf page everything is ok.
Page shows a table with paging, but I can't click on the paging arrows
(next page, previous etc.). When I click on page numbers (1 2 3 ... 10)
I get a exception like this :


javax.servlet.ServletException
	javax.faces.webapp.FacesServlet.service(FacesServlet.java:209)

*root cause*

java.lang.NullPointerException
	javax.faces.model.SelectItem.setValue(SelectItem.java:234)
	javax.faces.model.SelectItem.<init>(SelectItem.java:118)
	javax.faces.component.SelectItemsIterator.next(SelectItemsIterator.java:108)
	javax.faces.component.UISelectOne.matchValue(UISelectOne.java:141)
	javax.faces.component.UISelectOne.validateValue(UISelectOne.java:114)
	javax.faces.component.UIInput.validate(UIInput.java:645)
	javax.faces.component.UIInput.executeValidate(UIInput.java:849)
	javax.faces.component.UIInput.processValidators(UIInput.java:412)
	javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:912)
	javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:912)
	javax.faces.component.UIForm.processValidators(UIForm.java:170)
	javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:912)
	javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:342)
	com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:78)
	com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
	com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)
	javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)

*note* _The full stack trace of the root cause is available in the
Apache Tomcat/5.5.12 logs._



MY JSF PAGE:
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://xmlns.oracle.com/adf/faces" prefix="af"%>
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
<%@ taglib uri="http://xmlns.oracle.com/adf/faces/html" prefix="afh"%>

<html>
<head>
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=UTF-8" />
<title></title>

<link rel="stylesheet" type="text/css" href="../css/form.css" />
</head>
<body>

<f:loadBundle basename="bundle.Messages.Message" var="msg" />

<f:view>
    <h:form id="invoice_form">
        <h:panelGrid>
            <h:panelGrid columns="4">
                <h:outputText value="#{msg.invoice_nr}"
styleClass="labelcell" />
                <h:inputText id="invoice_nr" value=""
styleClass="fieldcell" />

                <h:outputText value="#{msg.print_place}"
styleClass="labelcell" />
                <h:inputText id="print_place" value=""
styleClass="fieldcell" />

                <h:outputText value="#{msg.pay_type}"
styleClass="labelcell" />
                <h:selectOneMenu id="pay_type" required="tue"
styleClass="fieldcell">
                    <f:selectItem itemValue="#{msg.remittance}"
                        itemLabel="#{msg.remittance}" />
                    <f:selectItem itemValue="#{msg.cash}"
itemLabel="#{msg.cash}" />
                </h:selectOneMenu>

                <h:outputText value="#{msg.print_date}"
styleClass="labelcell" />
                <h:panelGroup>
                    <h:inputText id="print_date" value=""
styleClass="fieldcell" />
                </h:panelGroup>

                <h:outputText value="#{msg.order_nr}"
styleClass="labelcell" />
                <h:inputText id="order_nr" value=""
styleClass="fieldcell" />

                <h:outputText value="#{msg.remmitance_days}"
styleClass="labelcell" />
                <h:inputText id="remmitance_days" value=""
styleClass="fieldcell" />

                <h:outputText value="#{msg.sell_date}"
styleClass="labelcell" />
                <h:inputText id="sell_date" value=""
styleClass="fieldcell" />

                <h:outputText value="#{msg.wz_nr}" styleClass="labelcell" />
                <h:inputText id="wz_nr" value="" styleClass="fieldcell" />

                <!-- start -->
                <h:outputText value="#{msg.choose_client}"
styleClass="labelcell" />
   
                <!-- end -->

    <h:panelGroup>
     <t:dataTable id="data"
                  styleClass="scrollerTable"
                  headerClass="standardTable_Header"
                  footerClass="standardTable_Header"
                  rowClasses="standardTable_Row1,standardTable_Row2"
                 
columnClasses="standardTable_Column,standardTable_ColumnCentered,standardTable_Column"
                  var="row"
                  value="#{clientList.list}"
                  preserveDataModel="true"
                  rows="10"
                  rowId="#{row.nip}"
                  rowOnClick="alert('rowId: ' + this.id)"
                  preserveSort="true">
        <h:column>
            <f:facet name="header"><h:outputText value="#{company_name}"
/></f:facet>
            <h:outputText value="#{row.nip}" />
        </h:column>
        <h:column>
            <f:facet name="header">
                <t:commandSortHeader columnName="type" arrow="true"
immediate="false">
                    <h:outputText value="#{nip}" />
                </t:commandSortHeader>
            </f:facet>
            <h:outputText value="#{row.name}" />
        </h:column>
    </t:dataTable>

    <h:panelGrid columns="1" styleClass="scrollerTable2"
columnClasses="standardTable_ColumnCentered" >
        <t:dataScroller id="scroll_1"
                        for="data"
                        fastStep="10"
                        pageCountVar="pageCount"
                        pageIndexVar="pageIndex"
                        styleClass="scroller"
                        paginator="true"
                        paginatorMaxPages="9"
                        paginatorTableClass="paginator"
                        paginatorActiveColumnStyle="font-weight:bold;">
            <f:actionListener type="test.DataScrollerActionListener"/>
            <f:facet name="first" >
                <t:graphicImage url="../images/arrow-first.gif"
border="1" />
            </f:facet>
            <f:facet name="last">
                <t:graphicImage url="../images/arrow-last.gif" border="1" />
            </f:facet>
            <f:facet name="previous">
                <t:graphicImage url="../images/arrow-previous.gif"
border="1" />
            </f:facet>
            <f:facet name="next">
                <t:graphicImage url="../images/arrow-next.gif" border="1" />
            </f:facet>
            <f:facet name="fastforward">
                <t:graphicImage url="../images/arrow-ff.gif" border="1" />
            </f:facet>
            <f:facet name="fastrewind">
                <t:graphicImage url="../images/arrow-fr.gif" border="1" />
            </f:facet>
        </t:dataScroller>
    </h:panelGrid>
    <h:inputText id="client_name" size="50" value=""
                        styleClass="fieldcell" />
</h:panelGroup>


            </h:panelGrid>
        </h:panelGrid>
    </h:form>
</f:view>
</body>
</html>




Do You know where is the problem ??
I had the same problem when I use Oracle ADF table.

regards

Re: t:dataTable problem

Posted by Mathias Brökelmann <mb...@googlemail.com>.
the select* component causes the problem. You use a message bundle
property value for a  selectItem value. This value is only available
in render phase. According to the jsf spec select* components must
validate the submitted value if it matches with a rendered value. This
will be done in the process validation phase which is before rendering
and any resource bundle is not available. Try to use this one:

<h:selectOneMenu ..>
  <f:selectItem itemValue="remittance" itemLabel="#{msg.remittance}" />
  <f:selectItem itemValue="cash" itemLabel="#{msg.cash}" />
</h:selectOneMenu>

and it should work

2005/11/22, Katareek <ka...@vp.pl>:
> Hi,
>
> I have problem with dataTable. When I invoke jsf page everything is ok.
> Page shows a table with paging, but I can't click on the paging arrows
> (next page, previous etc.). When I click on page numbers (1 2 3 ... 10)
> I get a exception like this :
>
>
> javax.servlet.ServletException
>         javax.faces.webapp.FacesServlet.service(FacesServlet.java:209)
>
> *root cause*
>
> java.lang.NullPointerException
>         javax.faces.model.SelectItem.setValue(SelectItem.java:234)
>         javax.faces.model.SelectItem.<init>(SelectItem.java:118)
>         javax.faces.component.SelectItemsIterator.next(SelectItemsIterator.java:108)
>         javax.faces.component.UISelectOne.matchValue(UISelectOne.java:141)
>         javax.faces.component.UISelectOne.validateValue(UISelectOne.java:114)
>         javax.faces.component.UIInput.validate(UIInput.java:645)
>         javax.faces.component.UIInput.executeValidate(UIInput.java:849)
>         javax.faces.component.UIInput.processValidators(UIInput.java:412)
>         javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:912)
>         javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:912)
>         javax.faces.component.UIForm.processValidators(UIForm.java:170)
>         javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:912)
>         javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:342)
>         com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:78)
>         com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
>         com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)
>         javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
>
> *note* _The full stack trace of the root cause is available in the
> Apache Tomcat/5.5.12 logs._
>
>
>
> MY JSF PAGE:
> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
> <%@ taglib uri="http://xmlns.oracle.com/adf/faces" prefix="af"%>
> <%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
> <%@ taglib uri="http://xmlns.oracle.com/adf/faces/html" prefix="afh"%>
>
> <html>
> <head>
> <meta HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=UTF-8" />
> <title></title>
>
> <link rel="stylesheet" type="text/css" href="../css/form.css" />
> </head>
> <body>
>
> <f:loadBundle basename="bundle.Messages.Message" var="msg" />
>
> <f:view>
>     <h:form id="invoice_form">
>         <h:panelGrid>
>             <h:panelGrid columns="4">
>                 <h:outputText value="#{msg.invoice_nr}"
> styleClass="labelcell" />
>                 <h:inputText id="invoice_nr" value=""
> styleClass="fieldcell" />
>
>                 <h:outputText value="#{msg.print_place}"
> styleClass="labelcell" />
>                 <h:inputText id="print_place" value=""
> styleClass="fieldcell" />
>
>                 <h:outputText value="#{msg.pay_type}"
> styleClass="labelcell" />
>                 <h:selectOneMenu id="pay_type" required="tue"
> styleClass="fieldcell">
>                     <f:selectItem itemValue="#{msg.remittance}"
>                         itemLabel="#{msg.remittance}" />
>                     <f:selectItem itemValue="#{msg.cash}"
> itemLabel="#{msg.cash}" />
>                 </h:selectOneMenu>
>
>                 <h:outputText value="#{msg.print_date}"
> styleClass="labelcell" />
>                 <h:panelGroup>
>                     <h:inputText id="print_date" value=""
> styleClass="fieldcell" />
>                 </h:panelGroup>
>
>                 <h:outputText value="#{msg.order_nr}"
> styleClass="labelcell" />
>                 <h:inputText id="order_nr" value=""
> styleClass="fieldcell" />
>
>                 <h:outputText value="#{msg.remmitance_days}"
> styleClass="labelcell" />
>                 <h:inputText id="remmitance_days" value=""
> styleClass="fieldcell" />
>
>                 <h:outputText value="#{msg.sell_date}"
> styleClass="labelcell" />
>                 <h:inputText id="sell_date" value=""
> styleClass="fieldcell" />
>
>                 <h:outputText value="#{msg.wz_nr}" styleClass="labelcell" />
>                 <h:inputText id="wz_nr" value="" styleClass="fieldcell" />
>
>                 <!-- start -->
>                 <h:outputText value="#{msg.choose_client}"
> styleClass="labelcell" />
>
>                 <!-- end -->
>
>     <h:panelGroup>
>      <t:dataTable id="data"
>                   styleClass="scrollerTable"
>                   headerClass="standardTable_Header"
>                   footerClass="standardTable_Header"
>                   rowClasses="standardTable_Row1,standardTable_Row2"
>
> columnClasses="standardTable_Column,standardTable_ColumnCentered,standardTable_Column"
>                   var="row"
>                   value="#{clientList.list}"
>                   preserveDataModel="true"
>                   rows="10"
>                   rowId="#{row.nip}"
>                   rowOnClick="alert('rowId: ' + this.id)"
>                   preserveSort="true">
>         <h:column>
>             <f:facet name="header"><h:outputText value="#{company_name}"
> /></f:facet>
>             <h:outputText value="#{row.nip}" />
>         </h:column>
>         <h:column>
>             <f:facet name="header">
>                 <t:commandSortHeader columnName="type" arrow="true"
> immediate="false">
>                     <h:outputText value="#{nip}" />
>                 </t:commandSortHeader>
>             </f:facet>
>             <h:outputText value="#{row.name}" />
>         </h:column>
>     </t:dataTable>
>
>     <h:panelGrid columns="1" styleClass="scrollerTable2"
> columnClasses="standardTable_ColumnCentered" >
>         <t:dataScroller id="scroll_1"
>                         for="data"
>                         fastStep="10"
>                         pageCountVar="pageCount"
>                         pageIndexVar="pageIndex"
>                         styleClass="scroller"
>                         paginator="true"
>                         paginatorMaxPages="9"
>                         paginatorTableClass="paginator"
>                         paginatorActiveColumnStyle="font-weight:bold;">
>             <f:actionListener type="test.DataScrollerActionListener"/>
>             <f:facet name="first" >
>                 <t:graphicImage url="../images/arrow-first.gif"
> border="1" />
>             </f:facet>
>             <f:facet name="last">
>                 <t:graphicImage url="../images/arrow-last.gif" border="1" />
>             </f:facet>
>             <f:facet name="previous">
>                 <t:graphicImage url="../images/arrow-previous.gif"
> border="1" />
>             </f:facet>
>             <f:facet name="next">
>                 <t:graphicImage url="../images/arrow-next.gif" border="1" />
>             </f:facet>
>             <f:facet name="fastforward">
>                 <t:graphicImage url="../images/arrow-ff.gif" border="1" />
>             </f:facet>
>             <f:facet name="fastrewind">
>                 <t:graphicImage url="../images/arrow-fr.gif" border="1" />
>             </f:facet>
>         </t:dataScroller>
>     </h:panelGrid>
>     <h:inputText id="client_name" size="50" value=""
>                         styleClass="fieldcell" />
> </h:panelGroup>
>
>
>             </h:panelGrid>
>         </h:panelGrid>
>     </h:form>
> </f:view>
> </body>
> </html>
>
>
>
>
> Do You know where is the problem ??
> I had the same problem when I use Oracle ADF table.
>
> regards
>


--
Mathias