You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Igor Vaynberg (JIRA)" <ji...@apache.org> on 2008/02/09 21:43:08 UTC
[jira] Resolved: (WICKET-1300) DropDownChoice without Model throws
RE in onSelectionChanged
[ https://issues.apache.org/jira/browse/WICKET-1300?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Igor Vaynberg resolved WICKET-1300.
-----------------------------------
Resolution: Invalid
Assignee: Igor Vaynberg
the no-model constructor should only be used when there is a compound property model or any other IInhertiableModel somewhere higher in the component hierarchy.
if you only care to get the model inside onselectionchanged callback then simply pass in a {code}new Model(){code} to the component
> DropDownChoice without Model throws RE in onSelectionChanged
> ------------------------------------------------------------
>
> Key: WICKET-1300
> URL: https://issues.apache.org/jira/browse/WICKET-1300
> Project: Wicket
> Issue Type: Bug
> Components: wicket
> Affects Versions: 1.3.0-rc1
> Reporter: Adriaan Koster
> Assignee: Igor Vaynberg
> Priority: Minor
>
> When I create a DropDownChoice using the constructor as advocated in the Wicket API I get a RuntimeException when I try to handle onSelectionChanged events.
> From http://people.apache.org/~tobrien/wicket/apidocs/index.html:
> List SITES = Arrays.asList(new String[] { "The Server Side", "Java Lobby", "Java.Net" });
> form.add(new DropDownChoice("site", SITES));
> My code throwing exception:
> List<Performance> performances = eventDao.listPerformances();
> // broken:
> DropDownChoice pickPerformance = new DropDownChoice("pickPerformance", performances)
> // workaround: new DropDownChoice("pickPerformance", new Model(null), performances)
> {
> protected boolean wantOnSelectionChangedNotifications() {
> return true;
> }
> @Override
> protected void onSelectionChanged(Object newSelection) {
> Performance event = (Performance) newSelection;
> }
> };
> add(pickPerformance);
> Output:
> 14:23:10,968 ERROR RequestCycle.logRuntimeException:1331 - [PoolThread-9] Method onSelectionChanged of interface org.apache.wicket.markup.html.form.IOnChangeListener targeted at component [MarkupContainer [Component id = pickPerformance, page = nl.topticketline.freeline.ui.ViewReservation, path = 1:pickPerformance.ViewReservation$3, isVisible = true, isVersioned = false]] threw an exception
> org.apache.wicket.WicketRuntimeException: Method onSelectionChanged of interface org.apache.wicket.markup.html.form.IOnChangeListener targeted at component [MarkupContainer [Component id = pickPerformance, page = nl.topticketline.freeline.ui.ViewReservation, path = 1:pickPerformance.ViewReservation$3, isVisible = true, isVersioned = false]] threw an exception
> at org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:194)
> at org.apache.wicket.request.target.component.listener.ListenerInterfaceRequestTarget.processEvents(ListenerInterfaceRequestTarget.java:73)
> at org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:90)
> at org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1094)
> at org.apache.wicket.RequestCycle.step(RequestCycle.java:1169)
> at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1248)
> at org.apache.wicket.RequestCycle.request(RequestCycle.java:489)
> at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:343)
> at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:193)
> at org.mortbay.jetty.servlet.WebApplicationHandler$Chain.doFilter(WebApplicationHandler.java:334)
> at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:286)
> at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:567)
> at org.mortbay.http.HttpContext.handle(HttpContext.java:1723)
> at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:514)
> at org.mortbay.http.HttpContext.handle(HttpContext.java:1673)
> at org.mortbay.http.HttpServer.service(HttpServer.java:879)
> at org.mortbay.http.HttpConnection.service(HttpConnection.java:783)
> at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:945)
> at org.mortbay.http.HttpConnection.handle(HttpConnection.java:800)
> at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:201)
> at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:289)
> at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:454)
> Caused by: java.lang.reflect.InvocationTargetException
> 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:585)
> at org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:183)
> ... 21 more
> Caused by: java.lang.IllegalStateException: Attempt to set model object on null model of component: pickPerformance
> at org.apache.wicket.Component.setModelObject(Component.java:2794)
> at org.apache.wicket.markup.html.form.FormComponent.updateModel(FormComponent.java:992)
> at org.apache.wicket.markup.html.form.DropDownChoice.onSelectionChanged(DropDownChoice.java:152)
> ... 26 more
> It works fine when I use the constructor below which also passes in a Model:
> new DropDownChoice("pickPerformance", new Model(null), performances)
>
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.