You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by "Altuğ B. Altıntaş" <al...@gmail.com> on 2009/10/09 13:07:05 UTC

DropDownChoice and onSelectionChanged error.

Hi;
I have a problem with DropDownChoice; The code block is here :

List<Faaliyet>faaliyetListesi = // data comes

 final DropDownChoice<Faaliyet> faaliyetler =
                new DropDownChoice<Faaliyet>("Faaliyetler",
                new Model((Serializable) faaliyetListesi),
faaliyetlerRenderer) {

                    @Override
                    protected boolean wantOnSelectionChangedNotifications()
{
                        return true;
                    }

                    @Override
                    protected void onSelectionChanged(Faaliyet newSelection)
{
                        super.onSelectionChanged(newSelection);
                        PageParameters params = new PageParameters();
                        params.add("ay", finalAy + "");
                        params.add("yil", finalYil + "");
                        params.add("faaliyetId", newSelection.getId() + "");
                        setResponsePage(ActionPage.class, params);

                    }
                };


        add(faaliyetler);



The error message is :

wicketMessage: Method onSelectionChanged of interface
org.apache.wicket.markup.html.form.IOnChangeListener targeted at
component [MarkupContainer [Component id = Faaliyetler]] threw an
exception

Root cause:

java.lang.IllegalStateException: Attempt to set model object on null
model of component: Faaliyetler
     at org.apache.wicket.Component.setDefaultModelObject(Component.java:3038)
     at org.apache.wicket.markup.html.form.FormComponent.updateModel(FormComponent.java:1168)
     at org.apache.wicket.markup.html.form.DropDownChoice.onSelectionChanged(DropDownChoice.java:158)
     at java.lang.reflect.Method.invoke(Method.java:597)
     at org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:182)
     at org.apache.wicket.request.target.component.listener.ListenerInterfaceRequestTarget.processEvents(ListenerInterfaceRequestTarget.java:73)
     at org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.j

-- 

Any suggestions ?

Altuğ.

Re: javscript header contribution in lazy load panels

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
Maybe you can post additional details... and then maybe someone can spot
what's happening.
Best,

Ernesto

On Fri, Oct 9, 2009 at 9:08 PM, Stefan Lindner <li...@visionet.de> wrote:

> It is added and a test script with an alert command tells me that it is
> executed too. But things like jQuery don't work.
>
> When I drop the lazy loading and replace it with the lazy loaded panel
> everything works.
>
> When I redraw the wohle panel in an Ajax call, everything works too.
>
> It's just the fact
>        1. having the javascript librarys loaded in the pages header section
> one time on the first page rendering heals all
>        2. having the javascript librarys loaded in the lazy loading ajax
> dom replacement it works only in IE. Even if the scripts are executed.
>
> I know, this may be a jquery/otherlib problem but perhaps someone else ever
> had this effect and found a workaround.
>
> Stefan.
>
> -----Ursprüngliche Nachricht-----
> Von: Ernesto Reinaldo Barreiro [mailto:reiern70@gmail.com]
> Gesendet: Freitag, 9. Oktober 2009 20:14
> An: users@wicket.apache.org
> Betreff: Re: javscript header contribution in lazy load panels
>
> Why not use firebug and see your <script> section is added the head of the
> page?
> Ernesto
>
> On Fri, Oct 9, 2009 at 4:51 PM, Stefan Lindner <li...@visionet.de>
> wrote:
>
> > I have some Behaviors that extend AbstractDefaultAjaxBehavior. In the
> > renderHead method of the Behaviors I use
> >        public void renderHead(IHeaderResponse response) {
> >
> >  response.renderJavascriptReference(WicketEventReference.INSTANCE);
> >        }
> >
> > But that's not the problem. When I look into Ajax debug output I can see
> > that the resource references are rendered correct. AND: in IE this works.
> > This must be some sort of jQuery internal problem or some security
> problem
> > in FF.
> >
> > Stefan
> >
> > -----Ursprüngliche Nachricht-----
> > Von: Ernesto Reinaldo Barreiro [mailto:reiern70@gmail.com]
> > Gesendet: Freitag, 9. Oktober 2009 15:36
> > An: users@wicket.apache.org
> > Betreff: Re: javscript header contribution in lazy load panels
> >
> > How do you add the JavaScript? I have pages where components are added
> via
> > AJAX, which include JavaScript and CSS via
> >
> add(JavascriptPackageResource.getHeaderContribution(ResourceReference...));
> >
> > and this works fine in any browser I have tested (IE, FF, Chrome, etc).
> >
> > Best,
> >
> > Ernesto
> >
> >
> > On Fri, Oct 9, 2009 at 2:25 PM, Stefan Lindner <li...@visionet.de>
> > wrote:
> >
> > > Dear wicket users,
> > >
> > > I have a lazy loading panel. The components inside the generated panel
> > > (i.e. the panel that is generated inside the getLazyLoadComponent
> method)
> > > have some header contributing ajax behaviors (jQuery etc.).
> > >
> > > The lazyly loaded components render javascript resources to the head
> > > section oft he page.
> > >
> > > When the page is created, the header does not contain any <script
> > > src="..."> tags. That's clear because wicket does not know which
> > resources
> > > are needed by the lazyly loaded panel. The <script src="..."> tags are
> > part
> > > of the ajax answer.
> > >
> > > IN IE this works well but in other Browsers (Firefox, Chrome, Safari)
> the
> > > javascript functionality does not work.
> > >
> > > We have to put the <script src="..."> manually into the parent page.
> > >
> > > Is this a known behavior? Does anybody know a magic trick to get the
> > > javascript librarys working that are part oft he ajax response?
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

RE: javscript header contribution in lazy load panels

Posted by Stefan Lindner <li...@visionet.de>.
It is added and a test script with an alert command tells me that it is executed too. But things like jQuery don't work.

When I drop the lazy loading and replace it with the lazy loaded panel everything works.

When I redraw the wohle panel in an Ajax call, everything works too.

It's just the fact
	1. having the javascript librarys loaded in the pages header section one time on the first page rendering heals all
	2. having the javascript librarys loaded in the lazy loading ajax dom replacement it works only in IE. Even if the scripts are executed.

I know, this may be a jquery/otherlib problem but perhaps someone else ever had this effect and found a workaround.

Stefan.

-----Ursprüngliche Nachricht-----
Von: Ernesto Reinaldo Barreiro [mailto:reiern70@gmail.com] 
Gesendet: Freitag, 9. Oktober 2009 20:14
An: users@wicket.apache.org
Betreff: Re: javscript header contribution in lazy load panels

Why not use firebug and see your <script> section is added the head of the
page?
Ernesto

On Fri, Oct 9, 2009 at 4:51 PM, Stefan Lindner <li...@visionet.de> wrote:

> I have some Behaviors that extend AbstractDefaultAjaxBehavior. In the
> renderHead method of the Behaviors I use
>        public void renderHead(IHeaderResponse response) {
>
>  response.renderJavascriptReference(WicketEventReference.INSTANCE);
>        }
>
> But that's not the problem. When I look into Ajax debug output I can see
> that the resource references are rendered correct. AND: in IE this works.
> This must be some sort of jQuery internal problem or some security problem
> in FF.
>
> Stefan
>
> -----Ursprüngliche Nachricht-----
> Von: Ernesto Reinaldo Barreiro [mailto:reiern70@gmail.com]
> Gesendet: Freitag, 9. Oktober 2009 15:36
> An: users@wicket.apache.org
> Betreff: Re: javscript header contribution in lazy load panels
>
> How do you add the JavaScript? I have pages where components are added via
> AJAX, which include JavaScript and CSS via
> add(JavascriptPackageResource.getHeaderContribution(ResourceReference...));
>
> and this works fine in any browser I have tested (IE, FF, Chrome, etc).
>
> Best,
>
> Ernesto
>
>
> On Fri, Oct 9, 2009 at 2:25 PM, Stefan Lindner <li...@visionet.de>
> wrote:
>
> > Dear wicket users,
> >
> > I have a lazy loading panel. The components inside the generated panel
> > (i.e. the panel that is generated inside the getLazyLoadComponent method)
> > have some header contributing ajax behaviors (jQuery etc.).
> >
> > The lazyly loaded components render javascript resources to the head
> > section oft he page.
> >
> > When the page is created, the header does not contain any <script
> > src="..."> tags. That's clear because wicket does not know which
> resources
> > are needed by the lazyly loaded panel. The <script src="..."> tags are
> part
> > of the ajax answer.
> >
> > IN IE this works well but in other Browsers (Firefox, Chrome, Safari) the
> > javascript functionality does not work.
> >
> > We have to put the <script src="..."> manually into the parent page.
> >
> > Is this a known behavior? Does anybody know a magic trick to get the
> > javascript librarys working that are part oft he ajax response?
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: javscript header contribution in lazy load panels

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
Why not use firebug and see your <script> section is added the head of the
page?
Ernesto

On Fri, Oct 9, 2009 at 4:51 PM, Stefan Lindner <li...@visionet.de> wrote:

> I have some Behaviors that extend AbstractDefaultAjaxBehavior. In the
> renderHead method of the Behaviors I use
>        public void renderHead(IHeaderResponse response) {
>
>  response.renderJavascriptReference(WicketEventReference.INSTANCE);
>        }
>
> But that's not the problem. When I look into Ajax debug output I can see
> that the resource references are rendered correct. AND: in IE this works.
> This must be some sort of jQuery internal problem or some security problem
> in FF.
>
> Stefan
>
> -----Ursprüngliche Nachricht-----
> Von: Ernesto Reinaldo Barreiro [mailto:reiern70@gmail.com]
> Gesendet: Freitag, 9. Oktober 2009 15:36
> An: users@wicket.apache.org
> Betreff: Re: javscript header contribution in lazy load panels
>
> How do you add the JavaScript? I have pages where components are added via
> AJAX, which include JavaScript and CSS via
> add(JavascriptPackageResource.getHeaderContribution(ResourceReference...));
>
> and this works fine in any browser I have tested (IE, FF, Chrome, etc).
>
> Best,
>
> Ernesto
>
>
> On Fri, Oct 9, 2009 at 2:25 PM, Stefan Lindner <li...@visionet.de>
> wrote:
>
> > Dear wicket users,
> >
> > I have a lazy loading panel. The components inside the generated panel
> > (i.e. the panel that is generated inside the getLazyLoadComponent method)
> > have some header contributing ajax behaviors (jQuery etc.).
> >
> > The lazyly loaded components render javascript resources to the head
> > section oft he page.
> >
> > When the page is created, the header does not contain any <script
> > src="..."> tags. That's clear because wicket does not know which
> resources
> > are needed by the lazyly loaded panel. The <script src="..."> tags are
> part
> > of the ajax answer.
> >
> > IN IE this works well but in other Browsers (Firefox, Chrome, Safari) the
> > javascript functionality does not work.
> >
> > We have to put the <script src="..."> manually into the parent page.
> >
> > Is this a known behavior? Does anybody know a magic trick to get the
> > javascript librarys working that are part oft he ajax response?
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

RE: javscript header contribution in lazy load panels

Posted by Stefan Lindner <li...@visionet.de>.
I have some Behaviors that extend AbstractDefaultAjaxBehavior. In the renderHead method of the Behaviors I use
	public void renderHead(IHeaderResponse response) {
		response.renderJavascriptReference(WicketEventReference.INSTANCE);
	}

But that's not the problem. When I look into Ajax debug output I can see that the resource references are rendered correct. AND: in IE this works. This must be some sort of jQuery internal problem or some security problem in FF.

Stefan

-----Ursprüngliche Nachricht-----
Von: Ernesto Reinaldo Barreiro [mailto:reiern70@gmail.com] 
Gesendet: Freitag, 9. Oktober 2009 15:36
An: users@wicket.apache.org
Betreff: Re: javscript header contribution in lazy load panels

How do you add the JavaScript? I have pages where components are added via
AJAX, which include JavaScript and CSS via
add(JavascriptPackageResource.getHeaderContribution(ResourceReference...));

and this works fine in any browser I have tested (IE, FF, Chrome, etc).

Best,

Ernesto


On Fri, Oct 9, 2009 at 2:25 PM, Stefan Lindner <li...@visionet.de> wrote:

> Dear wicket users,
>
> I have a lazy loading panel. The components inside the generated panel
> (i.e. the panel that is generated inside the getLazyLoadComponent method)
> have some header contributing ajax behaviors (jQuery etc.).
>
> The lazyly loaded components render javascript resources to the head
> section oft he page.
>
> When the page is created, the header does not contain any <script
> src="..."> tags. That's clear because wicket does not know which resources
> are needed by the lazyly loaded panel. The <script src="..."> tags are part
> of the ajax answer.
>
> IN IE this works well but in other Browsers (Firefox, Chrome, Safari) the
> javascript functionality does not work.
>
> We have to put the <script src="..."> manually into the parent page.
>
> Is this a known behavior? Does anybody know a magic trick to get the
> javascript librarys working that are part oft he ajax response?
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: javscript header contribution in lazy load panels

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
How do you add the JavaScript? I have pages where components are added via
AJAX, which include JavaScript and CSS via
add(JavascriptPackageResource.getHeaderContribution(ResourceReference...));

and this works fine in any browser I have tested (IE, FF, Chrome, etc).

Best,

Ernesto


On Fri, Oct 9, 2009 at 2:25 PM, Stefan Lindner <li...@visionet.de> wrote:

> Dear wicket users,
>
> I have a lazy loading panel. The components inside the generated panel
> (i.e. the panel that is generated inside the getLazyLoadComponent method)
> have some header contributing ajax behaviors (jQuery etc.).
>
> The lazyly loaded components render javascript resources to the head
> section oft he page.
>
> When the page is created, the header does not contain any <script
> src="..."> tags. That's clear because wicket does not know which resources
> are needed by the lazyly loaded panel. The <script src="..."> tags are part
> of the ajax answer.
>
> IN IE this works well but in other Browsers (Firefox, Chrome, Safari) the
> javascript functionality does not work.
>
> We have to put the <script src="..."> manually into the parent page.
>
> Is this a known behavior? Does anybody know a magic trick to get the
> javascript librarys working that are part oft he ajax response?
>

javscript header contribution in lazy load panels

Posted by Stefan Lindner <li...@visionet.de>.
Dear wicket users,

I have a lazy loading panel. The components inside the generated panel (i.e. the panel that is generated inside the getLazyLoadComponent method) have some header contributing ajax behaviors (jQuery etc.).

The lazyly loaded components render javascript resources to the head section oft he page.

When the page is created, the header does not contain any <script src="..."> tags. That's clear because wicket does not know which resources are needed by the lazyly loaded panel. The <script src="..."> tags are part of the ajax answer.

IN IE this works well but in other Browsers (Firefox, Chrome, Safari) the javascript functionality does not work.

We have to put the <script src="..."> manually into the parent page.

Is this a known behavior? Does anybody know a magic trick to get the javascript librarys working that are part oft he ajax response?

Re: DropDownChoice and onSelectionChanged error.

Posted by "Altuğ B. Altıntaş" <al...@gmail.com>.
Thanks Fatih. It is my fault, i solved the problem.
Altug.

2009/10/9 Fatih Mehmet Ucar <fm...@gmail.com>

> If you use the below constrcutor, it should solve your problem.
>
> DropDownChoice(java.lang.String id, IModel model, IModel choices,
> IChoiceRenderer renderer)
>
>
>
> 2009/10/9 Altuğ B. Altıntaş <al...@gmail.com>:
> > Hi;
> > I have a problem with DropDownChoice; The code block is here :
> >
> > List<Faaliyet>faaliyetListesi = // data comes
> >
> >  final DropDownChoice<Faaliyet> faaliyetler =
> >                new DropDownChoice<Faaliyet>("Faaliyetler",
> >                new Model((Serializable) faaliyetListesi),
> > faaliyetlerRenderer) {
> >
> >                    @Override
> >                    protected boolean
> wantOnSelectionChangedNotifications()
> > {
> >                        return true;
> >                    }
> >
> >                    @Override
> >                    protected void onSelectionChanged(Faaliyet
> newSelection)
> > {
> >                        super.onSelectionChanged(newSelection);
> >                        PageParameters params = new PageParameters();
> >                        params.add("ay", finalAy + "");
> >                        params.add("yil", finalYil + "");
> >                        params.add("faaliyetId", newSelection.getId() +
> "");
> >                        setResponsePage(ActionPage.class, params);
> >
> >                    }
> >                };
> >
> >
> >        add(faaliyetler);
> >
> >
> >
> > The error message is :
> >
> > wicketMessage: Method onSelectionChanged of interface
> > org.apache.wicket.markup.html.form.IOnChangeListener targeted at
> > component [MarkupContainer [Component id = Faaliyetler]] threw an
> > exception
> >
> > Root cause:
> >
> > java.lang.IllegalStateException: Attempt to set model object on null
> > model of component: Faaliyetler
> >     at
> org.apache.wicket.Component.setDefaultModelObject(Component.java:3038)
> >     at
> org.apache.wicket.markup.html.form.FormComponent.updateModel(FormComponent.java:1168)
> >     at
> org.apache.wicket.markup.html.form.DropDownChoice.onSelectionChanged(DropDownChoice.java:158)
> >     at java.lang.reflect.Method.invoke(Method.java:597)
> >     at
> org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:182)
> >     at
> org.apache.wicket.request.target.component.listener.ListenerInterfaceRequestTarget.processEvents(ListenerInterfaceRequestTarget.java:73)
> >     at
> org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.j
> >
> > --
> >
> > Any suggestions ?
> >
> > Altuğ.
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Altuğ.

Re: DropDownChoice and onSelectionChanged error.

Posted by Fatih Mehmet Ucar <fm...@gmail.com>.
If you use the below constrcutor, it should solve your problem.

DropDownChoice(java.lang.String id, IModel model, IModel choices,
IChoiceRenderer renderer)



2009/10/9 Altuğ B. Altıntaş <al...@gmail.com>:
> Hi;
> I have a problem with DropDownChoice; The code block is here :
>
> List<Faaliyet>faaliyetListesi = // data comes
>
>  final DropDownChoice<Faaliyet> faaliyetler =
>                new DropDownChoice<Faaliyet>("Faaliyetler",
>                new Model((Serializable) faaliyetListesi),
> faaliyetlerRenderer) {
>
>                    @Override
>                    protected boolean wantOnSelectionChangedNotifications()
> {
>                        return true;
>                    }
>
>                    @Override
>                    protected void onSelectionChanged(Faaliyet newSelection)
> {
>                        super.onSelectionChanged(newSelection);
>                        PageParameters params = new PageParameters();
>                        params.add("ay", finalAy + "");
>                        params.add("yil", finalYil + "");
>                        params.add("faaliyetId", newSelection.getId() + "");
>                        setResponsePage(ActionPage.class, params);
>
>                    }
>                };
>
>
>        add(faaliyetler);
>
>
>
> The error message is :
>
> wicketMessage: Method onSelectionChanged of interface
> org.apache.wicket.markup.html.form.IOnChangeListener targeted at
> component [MarkupContainer [Component id = Faaliyetler]] threw an
> exception
>
> Root cause:
>
> java.lang.IllegalStateException: Attempt to set model object on null
> model of component: Faaliyetler
>     at org.apache.wicket.Component.setDefaultModelObject(Component.java:3038)
>     at org.apache.wicket.markup.html.form.FormComponent.updateModel(FormComponent.java:1168)
>     at org.apache.wicket.markup.html.form.DropDownChoice.onSelectionChanged(DropDownChoice.java:158)
>     at java.lang.reflect.Method.invoke(Method.java:597)
>     at org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:182)
>     at org.apache.wicket.request.target.component.listener.ListenerInterfaceRequestTarget.processEvents(ListenerInterfaceRequestTarget.java:73)
>     at org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.j
>
> --
>
> Any suggestions ?
>
> Altuğ.
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org