Attempt to set model object on null model of component

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Attempt to set model object on null model of component

karthikg
I have a DropDownChoice that expects onSelectionChanged notification.
 
  DropDownChoice categories = new DropDownChoice(
    "categories", application.getBookDao().getSupportedCategories()){
   
   public boolean wantOnSelectionChangedNotifications() {
    return true;
   }
  public void onSelectionChanged(java.lang.Object newSelection) {
    ViewBooks.this.setSelectedCategory(newSelection.toString()); 
   }
 };
 
The drop down is rendered correctly with the choices. But when i select one, i see the following error -
 
**********************
wicket.WicketRuntimeException: Method public abstract void wicket.markup.html.form.IOnChangeListener.onSelectionChanged() of interface java.lang.reflect.Method threw an exception
 
 
Caused by: java.lang.IllegalStateException: Attempt to set model object on null model of component: categories
    at wicket.Component.setModelObject(Component.java:1299)
    at wicket.markup.html.form.AbstractSingleSelectChoice.setModelValue (AbstractSingleSelectChoice.java:168)
    at wicket.markup.html.form.AbstractSingleSelectChoice.updateModel(AbstractSingleSelectChoice.java:247)
    at wicket.markup.html.form.DropDownChoice.onSelectionChanged(DropDownChoice.java :140)
**********************
Any idea whats the problem here?
 
application.getBookDao().getSupportedCategories() returns a String[] with constants as a List (Arrays.asList( )).

thanks,
karthik
 
Reply | Threaded
Open this post in threaded view
|

Re: Attempt to set model object on null model of component

karthikg
Opps am sorry. I forgot to set the model for the DropDownChoice !

On 1/4/06, karthik Guru <[hidden email]> wrote:
I have a DropDownChoice that expects onSelectionChanged notification.
 
  DropDownChoice categories = new DropDownChoice(
    "categories", application.getBookDao().getSupportedCategories()){
   
   public boolean wantOnSelectionChangedNotifications() {
    return true;
   }
  public void onSelectionChanged(java.lang.Object newSelection) {
    ViewBooks.this.setSelectedCategory(newSelection.toString()); 
   }
 };
 
The drop down is rendered correctly with the choices. But when i select one, i see the following error -
 
**********************
wicket.WicketRuntimeException: Method public abstract void wicket.markup.html.form.IOnChangeListener.onSelectionChanged() of interface java.lang.reflect.Method threw an exception
 
 
Caused by: java.lang.IllegalStateException: Attempt to set model object on null model of component: categories
    at wicket.Component.setModelObject(Component.java:1299)
    at wicket.markup.html.form.AbstractSingleSelectChoice.setModelValue (AbstractSingleSelectChoice.java:168)
    at wicket.markup.html.form.AbstractSingleSelectChoice.updateModel(AbstractSingleSelectChoice.java:247)
    at wicket.markup.html.form.DropDownChoice.onSelectionChanged(DropDownChoice.java :140)
**********************
Any idea whats the problem here?
 
application.getBookDao().getSupportedCategories() returns a String[] with constants as a List (Arrays.asList( )).

thanks,
karthik