myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matthias Wessendorf" <mat...@apache.org>
Subject Re: [Trinidad] SelectManyShuttle NullPointerException and Understanding
Date Wed, 15 Aug 2007 11:58:38 GMT
your shuttle isn't included in a
form

<tr:form>
<tr:selectManyShuttle leadingHeader="Not Selected"
trailingHeader="Selected" value="#{detailsBean.selected}">
<f:selectItems value="#{detailsBean.all}" />
</tr:selectManyShuttle>
</tr:form>

that's the NPE.

Yes, the usage is like that.
<f:selectItems /> is for "the available items"
and the value for the "selected" meaning, what goes to your bean.

That said,
when the List already contains some of these available values, they
show up on the right side, when rendering:

faces page:
<tr:...Shuttle ... value="#{bean.manyInitialValues}">

  <tr:selectItem label="coffee" value="bean" shortDesc="Coffee from Kona"/>
  <tr:selectItem label="tea" value="leaf" shortDesc="Tea from China"/>
  <tr:selectItem label="orange juice" value="orange"/>
  <tr:selectItem label="milk" value="moo"/>
</...shuttle>

Java:
  private List _manyInitialValues = new ArrayList();
  //plus accessors

adding the already available values:
    _manyInitialValues.add("bean");
    _manyInitialValues.add("leaf");
    _manyInitialValues.add("orange");
    _manyInitialValues.add("moo");


HTH,
Matthias






On 8/15/07, Tilo Gau <normad2@gmx.de> wrote:
> Hi,
>
> I have quite a trouble to unterstand the SelectManyShuttle and get it running.
>
> First, how I understood the SelectManyShuttle so far:
> <tr:selectManyShuttle leadingHeader="Not Selected" trailingHeader="Selected" value="#{detailsBean.selected}">
> <f:selectItems value="#{detailsBean.all}" />
> </tr:selectManyShuttle>
>
> The value in <tr:selectManyShuttle /> is a List of indexes of the selected items.
>
> The value in <f:selectItems /> is a List of SelectItems with index, label and description
of all items.
>
>
>
> Second, how I implemented the according methods:
>
> public List<SelectItem> getAll() {
>     List<SelectItem> list = new ArrayList<SelectItem>();
>     for(Iterator it = getAllItems().iterator();it.hasNext();){
>         Item item = (Item)it.next();
>         list.add(new SelectItem(item .getId(), item .getLabel(), item .getDescription()));
>     }
>     return list;
> }
>
> public List<Integer> getSelected(){
> List<Integer> list = new ArrayList<Integer>();
>     for(Iterator it = getSelectedItems().iterator();it.hasNext();){
>         Item item = (Item)it.next();
>         list.add(item.getId());
>     }
>     return list;
> }
>
>
>
> Third, what error I got, when I tried to show the page:
>
> java.lang.NullPointerException
>         at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.SelectManyShuttleRenderer$ShuttleList.getOndblclick(SelectManyShuttleRenderer.java:901)
>         at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.XhtmlRenderer.renderEventHandlers(XhtmlRenderer.java:460)
>         at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.FormElementRenderer.renderEventHandlers(FormElementRenderer.java:193)
>         at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.XhtmlRenderer.renderAllAttributes(XhtmlRenderer.java:316)
>         at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.FormInputRenderer.renderAllAttributes(FormInputRenderer.java:109)
>         at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.SimpleSelectManyListboxRenderer.encodeElementContent(SimpleSelectManyListboxRenderer.java:79)
>         at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.SimpleSelectManyRenderer.encodeAllAsElement(SimpleSelectManyRenderer.java:368)
>         at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.FormElementRenderer.encodeAll(FormElementRenderer.java:109)
>         at org.apache.myfaces.trinidad.render.CoreRenderer.delegateRenderer(CoreRenderer.java:318)
>         at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.SelectManyShuttleRenderer$Box.encodeAllChildren(SelectManyShuttleRenderer.java:1115)
>         at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.PanelBoxRenderer._renderContent(PanelBoxRenderer.java:413)
>         at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.PanelBoxRenderer._renderBody(PanelBoxRenderer.java:340)
>         at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.PanelBoxRenderer._renderMiddleRow(PanelBoxRenderer.java:267)
>         at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.PanelBoxRenderer.encodeAll(PanelBoxRenderer.java:115)
>         at org.apache.myfaces.trinidad.render.CoreRenderer.delegateRenderer(CoreRenderer.java:318)
>         at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.SelectManyShuttleRenderer._renderContainerRow(SelectManyShuttleRenderer.java:577)
>         at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.SelectManyShuttleRenderer.encodeElementContent(SelectManyShuttleRenderer.java:312)
>         at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.SimpleSelectManyRenderer.encodeAllAsElement(SimpleSelectManyRenderer.java:368)
>         at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.FormElementRenderer.encodeAll(FormElementRenderer.java:109)
>         at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:208)
>         at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:694)
>         at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:287)
>         at org.apache.myfaces.trinidad.render.CoreRenderer.encodeAllChildren(CoreRenderer.java:304)
>         at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.PanelPartialRootRenderer.renderContent(PanelPartialRootRenderer.java:72)
>         at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.BodyRenderer.renderContent(BodyRenderer.java:136)
>         at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.PanelPartialRootRenderer.encodeAll(PanelPartialRootRenderer.java:152)
>         at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.BodyRenderer.encodeAll(BodyRenderer.java:78)
>         at org.apache.myfaces.trinidad.render.CoreRenderer.delegateRenderer(CoreRenderer.java:318)
>         at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.DocumentRenderer.encodeAll(DocumentRenderer.java:80)
>         at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:208)
>         at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:694)
>         at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:242)
>         at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:239)
>         at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:580)
>         at org.apache.myfaces.trinidadinternal.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:181)
>         at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
>         at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
>         at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
>         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
>         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
>         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._invokeDoFilter(TrinidadFilterImpl.java:208)
>         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:165)
>         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:138)
>         at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
>         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.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
>         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
>         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.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
>         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
>         at java.lang.Thread.run(Unknown Source)
>
> Does somebody have  an idea, what goes wrong?
> Thank you in advance,
> Tilo
>
> --
> GMX FreeMail: 1 GB Postfach, 5 E-Mail-Adressen, 10 Free SMS.
> Alle Infos und kostenlose Anmeldung: http://www.gmx.net/de/go/freemail
>


-- 
Matthias Wessendorf

further stuff:
blog: http://matthiaswessendorf.wordpress.com/
mail: matzew-at-apache-dot-org

Mime
View raw message