gpt4 book ai didi

java - 两个 selectManyListbox 出错

转载 作者:行者123 更新时间:2023-12-01 15:47:58 25 4
gpt4 key购买 nike

我有两个相关的selectManyListbox(第二个是根据第一个生成的),但是当我运行应用程序时发生错误:

JSF:

<h:selectManyListbox   value="#{TestAjax.selectedProjects}"  id="project" size="3">
<f:selectItem itemLabel="-- Select Projects -- " itemValue="0"/>
<f:selectItems value="#{TestAjax.getMyListProject()}" />
<f:ajax event="change" render="status" />
</h:selectManyListbox>

<h:selectManyListbox value="#{TestAjax.selectedstatus}" id="status" size="3">
<f:selectItem itemLabel="-- Select status -- " itemValue="0"/>
<f:selectItems value="#{TestAjax.StepsByProject()}" />
</h:selectManyListbox>

错误:

java.lang.NullPointerException
at DAOKPI.TestAjax.FormattingVar(TestAjax.java:342)
at DAOKPI.TestAjax.StepsByProject(TestAjax.java:367)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at javax.el.BeanELResolver.invokeMethod(BeanELResolver.java:737)
at javax.el.BeanELResolver.invoke(BeanELResolver.java:467)
at javax.el.CompositeELResolver.invoke(CompositeELResolver.java:254)
at com.sun.el.parser.AstValue.getValue(AstValue.java:111)
at com.sun.el.parser.AstValue.getValue(AstValue.java:163)
at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:219)
at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:109)
at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:194)
at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:182)
at javax.faces.component.UISelectItems.getValue(UISelectItems.java:129)
at com.sun.faces.renderkit.SelectItemsIterator.initializeItems(SelectItemsIterator.java:202)
at com.sun.faces.renderkit.SelectItemsIterator.hasNext(SelectItemsIterator.java:135)
at com.sun.faces.renderkit.html_basic.MenuRenderer.renderOptions(MenuRenderer.java:762)
at com.sun.faces.renderkit.html_basic.MenuRenderer.renderSelect(MenuRenderer.java:844)
at com.sun.faces.renderkit.html_basic.MenuRenderer.encodeEnd(MenuRenderer.java:298)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:875)
at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java :312)
at com.sun.faces.renderkit.html_basic.GridRenderer.renderRow(GridRenderer.java:185)
at com.sun.faces.renderkit.html_basic.GridRenderer.encodeChildren(GridRenderer.java:129)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845)
at org.primefaces.renderkit.CoreRenderer.renderChild(CoreRenderer.java:55)
at org.primefaces.renderkit.CoreRenderer.renderChildren(CoreRenderer.java:43)
at org.primefaces.component.panel.PanelRenderer.encodeContent(PanelRenderer.java:229)
at org.primefaces.component.panel.PanelRenderer.encodeMarkup(PanelRenderer.java:152)
at org.primefaces.component.panel.PanelRenderer.encodeEnd(PanelRenderer.java:75)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:875)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1763)
at javax.faces.render.Renderer.encodeChildren(Renderer.java:168)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1756)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1759)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1759)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingSt rategy.java:401)
at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)

最佳答案

java.lang.NullPointerException
at DAOKPI.TestAjax.FormattingVar(TestAjax.java:342)
at DAOKPI.TestAjax.StepsByProject(TestAjax.java:367)

这会告诉您所有您需要知道的信息。您的类 TestAjax 中发生空指针异常,方法为 FormattingVar(),行号为 342。从您的 JSF 页面来看,错误发生在第二个 selectManyListbox 中,正如堆栈跟踪中的 StepsByProject() 所见

关于java - 两个 selectManyListbox 出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6745129/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com