尝试在数据表中显示列表时遇到 NumberFormatException。我知道发生此异常的一般原因,但无法弄清楚它适用于我的情况。
这是我的冰:数据表显示代码
<ice:dataTable id="transformations" var="transformationList" width="700"
value="#{ShowStatusBean.transformationStatusList}" rows="10"
partialTriggers="refreshButton" autoSubmit="true">
<ice:column>
<ice:outputText value="#{transformationList.businessDate}" />
</ice:column>
<ice:column>
<ice:outputText value="#{transformationList.service}" />
</ice:column>
<ice:column>
<ice:outputText value="#{transformationList.status}" />
</ice:column>
</ice:dataTable>
还有我的支持 bean 代码
public List<TransformationBean> getTransformationStatusList() {
transformationStatusList = new ArrayList<TransformationBean>();
transformationStatusList.add(new TransformationBean("2012-01-01", "serviceName", "status1"));
transformationStatusList.add(new TransformationBean("2012-01-02", "serviceName2", "status2"));
return transformationStatusList;
}
最后是堆栈跟踪
23:59:57 ERROR [f-tuning)'] D2DFaceletViewHandler - Problem in renderResponse: For input string: "businessDate"
java.lang.NumberFormatException: For input string: "businessDate"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
at java.lang.Integer.parseInt(Integer.java:449)
at java.lang.Integer.parseInt(Integer.java:499)
at com.sun.facelets.el.LegacyELContext$LegacyELResolver.getValue(LegacyELContext.java:138)
at com.sun.el.parser.AstValue.getValue(AstValue.java:96)
at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:183)
at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:71)
at com.sun.facelets.el.LegacyValueBinding.getValue(LegacyValueBinding.java:56)
at javax.faces.component.UIOutput.getValue(UIOutput.java:80)
at com.icesoft.faces.renderkit.dom_html_basic.OutputTextRenderer.encodeEnd(OutputTextRenderer.java:91)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:539)
at com.icesoft.faces.renderkit.dom_html_basic.DomBasicRenderer.encodeParentAndChildren(DomBasicRenderer.java:369)
at com.icesoft.faces.renderkit.dom_html_basic.DomBasicRenderer.encodeParentAndChildren(DomBasicRenderer.java:364)
at com.icesoft.faces.component.ext.renderkit.TableRenderer.encodeChildren(TableRenderer.java:896)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:527)
at com.icesoft.faces.renderkit.dom_html_basic.DomBasicRenderer.encodeParentAndChildren(DomBasicRenderer.java:357)
at com.icesoft.faces.renderkit.dom_html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:95)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:527)
at com.icesoft.faces.component.util.CustomComponentUtils.renderChild(CustomComponentUtils.java:338)
at com.icesoft.faces.component.panelpopup.PanelPopupRenderer.encodeBegin(PanelPopupRenderer.java:240)
at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:515)
at com.icesoft.faces.renderkit.dom_html_basic.DomBasicRenderer.encodeParentAndChildren(DomBasicRenderer.java:355)
at com.icesoft.faces.renderkit.dom_html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:95)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:527)
at com.icesoft.faces.renderkit.dom_html_basic.DomBasicRenderer.encodeParentAndChildren(DomBasicRenderer.java:357)
at com.icesoft.faces.renderkit.dom_html_basic.DomBasicRenderer.encodeParentAndChildren(DomBasicRenderer.java:364)
at com.icesoft.faces.renderkit.dom_html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:95)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:527)
at com.icesoft.faces.renderkit.dom_html_basic.DomBasicRenderer.encodeParentAndChildren(DomBasicRenderer.java:357)
at com.icesoft.faces.renderkit.dom_html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:95)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:527)
at com.icesoft.faces.component.util.CustomComponentUtils.renderChild(CustomComponentUtils.java:338)
at com.icesoft.faces.component.paneltabset.PanelTabSetRenderer.writeTabCell(PanelTabSetRenderer.java:983)
at com.icesoft.faces.component.paneltabset.PanelTabSetRenderer.encodeEnd(PanelTabSetRenderer.java:422)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:539)
at javax.faces.component.UIData.encodeEnd(UIData.java:573)
at com.icesoft.faces.renderkit.dom_html_basic.DomBasicRenderer.encodeParentAndChildren(DomBasicRenderer.java:369)
at com.icesoft.faces.renderkit.dom_html_basic.GridRenderer.encodeChildren(GridRenderer.java:207)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:527)
at com.icesoft.faces.renderkit.dom_html_basic.DomBasicRenderer.encodeParentAndChildren(DomBasicRenderer.java:357)
at com.icesoft.faces.renderkit.dom_html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:95)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:527)
at com.icesoft.faces.renderkit.dom_html_basic.DomBasicRenderer.encodeParentAndChildren(DomBasicRenderer.java:357)
at com.icesoft.faces.renderkit.dom_html_basic.DomBasicRenderer.encodeParentAndChildren(DomBasicRenderer.java:364)
at com.icesoft.faces.renderkit.dom_html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:95)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:527)
at com.icesoft.faces.renderkit.dom_html_basic.DomBasicRenderer.encodeParentAndChildren(DomBasicRenderer.java:357)
at com.icesoft.faces.renderkit.dom_html_basic.DomBasicRenderer.encodeParentAndChildren(DomBasicRenderer.java:364)
at com.icesoft.faces.renderkit.dom_html_basic.DomBasicRenderer.encodeParentAndChildren(DomBasicRenderer.java:364)
at com.icesoft.faces.renderkit.dom_html_basic.DomBasicRenderer.encodeParentAndChildren(DomBasicRenderer.java:364)
at com.icesoft.faces.renderkit.dom_html_basic.DomBasicRenderer.encodeParentAndChildren(DomBasicRenderer.java:364)
at com.icesoft.faces.renderkit.dom_html_basic.DomBasicRenderer.encodeParentAndChildren(DomBasicRenderer.java:364)
at com.icesoft.faces.renderkit.dom_html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:95)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:527)
at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:490)
at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:495)
at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:495)
at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:495)
at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:495)
at com.icesoft.faces.facelets.D2DFaceletViewHandler.renderResponse(D2DFaceletViewHandler.java:281)
at com.icesoft.faces.application.D2DViewHandler.renderView(D2DViewHandler.java:155)
at com.icesoft.faces.application.ViewHandlerProxy.renderView(ViewHandlerProxy.java:70)
at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:41)
at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:132)
at com.icesoft.faces.webapp.http.core.JsfLifecycleExecutor.apply(JsfLifecycleExecutor.java:51)
at com.icesoft.faces.webapp.http.core.ReceiveSendUpdates.renderCycle(ReceiveSendUpdates.java:171)
at com.icesoft.faces.webapp.http.core.ReceiveSendUpdates.service(ReceiveSendUpdates.java:112)
at com.icesoft.faces.webapp.http.core.RequestVerifier.service(RequestVerifier.java:65)
at com.icesoft.faces.webapp.http.servlet.BasicAdaptingServlet.service(BasicAdaptingServlet.java:48)
at com.icesoft.faces.webapp.http.servlet.SessionVerifier.service(SessionVerifier.java:58)
at com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:55)
at com.icesoft.faces.webapp.http.servlet.SessionDispatcher.service(SessionDispatcher.java:77)
at com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:55)
at com.icesoft.faces.webapp.http.servlet.MainServlet.service(MainServlet.java:192)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at com.icesoft.faces.webapp.xmlhttp.BlockingServlet.service(BlockingServlet.java:67)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:301)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3730)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3696)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2273)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2179)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1490)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
还有我的 TransformationBean
public class TransformationBean{
private String businessDate;
private String service;
private String status;
// constructor
// getter and setters
}
我研究了这个问题并找到了很多回应。但看起来我没有犯任何这些错误..所以不确定我错过了什么。这些是我发现的关于同一问题的其他链接。
http://jforum.icesoft.org/JForum/posts/list/16645.page
所有这些都提到从 java 代码返回的 List<> 是 Object[] 的 List,这就是为什么它试图通过将属性视为索引属性来访问数组条目的原因。但是,从我的代码中,很明显,我没有返回 Object[] 的 List ,而是正确定义的 List
我还在 JUNit 测试用例中测试了 java 代码,并验证了返回类型是 TransformationBean 对象的列表。
伙计们,我做错了什么?