1

I'm working on a Primefaces 5 app and after changing some of my dataTable views from single to multiple selection... whenever I try to modify the contents of the rows I get this error:

Jul 30, 2014 9:36:38 PM com.sun.faces.lifecycle.ProcessValidationsPhase execute
WARNING: For input string: "get"
java.lang.NumberFormatException: For input string: "get"
at java.lang.NumberFormatException.forInputString(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at javax.el.ListELResolver.coerce(ListELResolver.java:174)
at javax.el.ListELResolver.getValue(ListELResolver.java:52)
at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176)
at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203)
at org.apache.el.parser.AstValue.getTarget(AstValue.java:121)
at org.apache.el.parser.AstValue.getType(AstValue.java:82)
at org.apache.el.ValueExpressionImpl.getType(ValueExpressionImpl.java:176)
at com.sun.faces.facelets.el.TagValueExpression.getType(TagValueExpression.java:98)
at org.primefaces.util.ComponentUtils.getConverter(ComponentUtils.java:126)
at org.primefaces.renderkit.InputRenderer.getConvertedValue(InputRenderer.java:171)
at javax.faces.component.UIInput.getConvertedValue(UIInput.java:1034)
at javax.faces.component.UIInput.validate(UIInput.java:964)
at javax.faces.component.UIInput.executeValidate(UIInput.java:1237)
at javax.faces.component.UIInput.processValidators(UIInput.java:702)

it really starts to bother me since I can't figure out what's wrong...

this is the dataTable header :

<p:dataTable id="ordDataTable" var="r" rowIndexVar="rowIndex"
value="#{ordController.lazyModel}" rows="10"
widgetVar="dtWidgetVar" paginator="true"
paginatorTemplate="
                   {CurrentPageReport} {FirstPageLink} {PreviousPageLink} 
                   {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
rowsPerPageTemplate="10,15,50,100,500,1000"
filteredValue="#{ordController.filteredList}"
selection="#{ordController.selectionList}"
filterMap="#{ordersFilterBackingBean.filterMap}"
selectionMode="multiple" lazy="true" sortOrder="ascending"
resizableColumns="true" tableStyle="width:auto">

And this is where I make the changes:

            <!-- Dialog for updating an EXISTING Order -->
        <p:dialog header="#{msgs.CRUD_dlgModify}" widgetVar="CRUD_updateDlg"
            resizable="false" id="CRUD_update">
            <p:outputPanel id="updatePanel">
                <h:form id="updateOrd">
                    <p:panelGrid columns="2">
                        <p:panelGrid columns="2">
                        #{msgs.Column_order_id}
                        <p:inputText
                                value="#{ordController.selectionList.get(0).order_id}" disabled="true" />
                        #{msgs.Column_inherited_id}
                        <p:inputText
                                value="#{ordController.selectionList.get(0).inherited_id}" />

                        #{msgs.Column_start_time}*
                        <p:calendar
                                value="#{ordController.selectionList.get(0).start_time}"
                                pattern="MM/dd/yyyy HH:mm" />

                        #{msgs.Column_priority}*
                         <h:selectOneMenu
                                value="#{ordController.selectionList.get(0).priority}">
                                <f:selectItems value="#{ordController.priorityList}" var="v"
                                    itemLabel="#{v.t2}" itemValue="#{v.t1}" />
                            </h:selectOneMenu>

                        #{msgs.Column_agent}*
                            <h:selectOneMenu
                                value="#{ordController.selectionList.get(0).agent}">
                                <f:selectItems value="#{ordController.agentList}" var="v"
                                    itemLabel="#{v.t2}" itemValue="#{v.t1}" />
                            </h:selectOneMenu>
                        #{msgs.Column_observations}
                        <p:inputText
                                value="#{ordController.selectionList.get(0).observations}" />
                        </p:panelGrid>

                        <p:panelGrid columns="2">
                            #{msgs.Column_order_id_ext}
                            <p:inputText
                                value="#{ordController.selectionList.get(0).order_id_ext}" />

                            #{msgs.Column_order_no}*
                            <p:inputText
                                value="#{ordController.selectionList.get(0).order_no}" />

                            #{msgs.Column_stop_time}*
                            <p:calendar
                                value="#{ordController.selectionList.get(0).stop_time}"
                                pattern="MM/dd/yyyy HH:mm" />

                             #{msgs.Column_client_id}*
                               <h:selectOneMenu
                                value="#{ordController.selectionList.get(0).client_id}">
                                <f:selectItems value="#{ordController.clientIDList}" var="v"
                                    itemLabel="#{v.t2}" itemValue="#{v.t1}" />
                            </h:selectOneMenu>                               
                             #{msgs.Column_truck_plate}
                             <p:inputText
                                value="#{ordController.selectionList.get(0).truck_plate}" />
                        </p:panelGrid>

                    </p:panelGrid>
                    <p:commandButton value="#{msgs.CRUD_btnSubmit}"
                        actionListener="#{ordController.updateOrd}"
                        oncomplete="PF('CRUD_updateDlg').hide()"
                        update=":form:ordDataTable :form:messages" />
                </h:form>
            </p:outputPanel>
        </p:dialog>

don't think it is relevant but somebody might ask...

  public void updateOrd() {
if (selectionList.size() == 0 || selectionList.size() > 1) {
  FacesUtils.addErrorMessage(ResourceBundleUtils.getMessage(IBundleMsgs.NO_ROW_SELECTED));
} else {
  Orders order = selectionList.get(0);
  Map<String, Object> paramMap = new HashMap<String, Object>();
  selectionList.get(0).setStart_time_char(DateUtils.DateToString(selectionList.get(0).getStart_time()));
  selectionList.get(0).setStop_time_char(DateUtils.DateToString(selectionList.get(0).getStop_time()));
  paramMap.put("p_order_id", order.getOrder_id());
  ...params....
  SQLResult result = ordServ.updateOrders(paramMap);
  if (result.isOk()) {
    FacesUtils.addMessage(result.getResultMessage());
  } else {
    FacesUtils.addErrorMessage(result.getResultMessage());
  }
}

}

2
  • I'd have thought you need selectionList[0] everywhere in the xhtml, but have no experience with it... :-( Commented Jul 30, 2014 at 19:21
  • @JaqenH'ghar thanks, man... that was it. post it as an asnwer so i can tag it as correct :) Commented Jul 30, 2014 at 19:44

1 Answer 1

2

In Expression Language, indexing into a list is done with

listName[i]

instead of the normal java syntax

listName.get(i)

The first element is still at index 0.

Sign up to request clarification or add additional context in comments.

1 Comment

Wtf, I had this exception on closing a modal dialogue when I had called get() in the parent window, but only when closing the modal subdialogue. Until then, the parent dialogue worked fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.