You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by A nono life <a....@gmail.com> on 2008/06/19 21:37:54 UTC

[Newbie]Session lost in an AjaxFallbackLink onClick()

Hi,

When in an AjaxFallbackLink's onClick(), the object I retrieve from my
session is null, even if in my form constructor the object was properly
retrieved :
public CreatureForm(String id, HibernateObjectModel object ) {
   	super(id,  object);
	Creature sessionCreature = ((DemoUser) ((DemoSession)
getSession()).getUser()).getCreature() ;
	System.out.println("Creature name in the form : " +
sessionCreature.getName());
	System.out.println("Creature location : " +
sessionCreature.getCurrentXP());
	add(new AjaxFallbackLink("aLink"){
	 @Override
	 public void onClick(AjaxRequestTarget target) {
		Creature sessionCreature = ((DemoUser) ((DemoSession)
getSession()).getUser()).getCreature() ;
		System.out.println("Creature name in the form : " +
sessionCreature.getName());
		System.out.println("Creature location : " +
sessionCreature.getCurrentXP());
	 }
}

In the onClick, I get a java.lang.NullPointerException...

What do I do wrong ?

Thanks in advance
++
Nono
-- 
View this message in context: http://www.nabble.com/-Newbie-Session-lost-in-an-AjaxFallbackLink-onClick%28%29-tp18016504p18016504.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: [Newbie]Session lost in an AjaxFallbackLink onClick()

Posted by Eyal Golan <eg...@gmail.com>.
where is your NullPointerException?
Creature sessionCreature = ((DemoUser) ((DemoSession)
getSession()).getUser()).getCreature() ;
The Session or the user?


On Fri, Jun 20, 2008 at 11:49 AM, A nono life <a....@gmail.com> wrote:

>
> Hi
>
> A little up... Any help welcome :$
>
> Thanks in advance
>
> Nono
> --
> View this message in context:
> http://www.nabble.com/-Newbie-Session-lost-in-an-AjaxFallbackLink-onClick%28%29-tp18016504p18025072.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Eyal Golan
egolan74@gmail.com

Visit: http://jvdrums.sourceforge.net/
LinkedIn: http://www.linkedin.com/in/egolan74

Re: [Newbie]Session lost in an AjaxFallbackLink onClick()

Posted by A nono life <a....@gmail.com>.
Hi

A little up... Any help welcome :$

Thanks in advance

Nono
-- 
View this message in context: http://www.nabble.com/-Newbie-Session-lost-in-an-AjaxFallbackLink-onClick%28%29-tp18016504p18025072.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: [Newbie]Session lost in an AjaxFallbackLink onClick()

Posted by A nono life <a....@gmail.com>.

Gwyn wrote:
> 
> Try & reproduce it in a QuickStart, so someone else can investigate?
> 

Ok, it's done :  http://www.nabble.com/file/p18044618/issueTest.tar.gz
issueTest.tar.gz .

BTW, it's an Databinder app. Everything will be launched in memory. When you
start, you'll be invited to enter the creature's name, then you'll be
redirected on the creature page where you'll be able to click on a "+" link
to increase its hitpoints... it's the link which fails.

BTW, doing this quickstart, I've noticed that it was working a bit better
when, in the DemoApp init, I was adding manually the creature to the user
(see the TODO). However, in this case, the update I do on the model aren't
kept, so it doesn't work properly neither...

Thanks again

bye
nono

-- 
View this message in context: http://www.nabble.com/-Newbie-Session-lost-in-an-AjaxFallbackLink-onClick%28%29-tp18016504p18044618.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: [Newbie]Session lost in an AjaxFallbackLink onClick()

Posted by Gwyn Evans <gw...@gmail.com>.
Try & reproduce it in a QuickStart, so someone else can investigate?

/Gwyn

On Fri, Jun 20, 2008 at 9:36 PM, A nono life <a....@gmail.com> wrote:

>
> hi again
>
> A nono life wrote:
> >
> > I did the following try in between :
> > - I rightly get the user and its content. So this part is properly
> working
> > - I've  tried the form's onSubmit, and there I get some part of my
> > creature data but not all of it (I get the name but not others
> > attributes...).
> >
> I'm planning to display messages when my creature data are changed, maybe
> it
> could help. If you've any other ideas of things I could try, let me know !
>
> This issue is very annoying, looking so strange for something normally so
> easy :'(
>
> bye
> nono
> --
> View this message in context:
> http://www.nabble.com/-Newbie-Session-lost-in-an-AjaxFallbackLink-onClick%28%29-tp18016504p18036976.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: [Newbie]Session lost in an AjaxFallbackLink onClick()

Posted by A nono life <a....@gmail.com>.
hi again

A nono life wrote:
> 
> I did the following try in between :
> - I rightly get the user and its content. So this part is properly working
> - I've  tried the form's onSubmit, and there I get some part of my
> creature data but not all of it (I get the name but not others
> attributes...).
> 
I'm planning to display messages when my creature data are changed, maybe it
could help. If you've any other ideas of things I could try, let me know !

This issue is very annoying, looking so strange for something normally so
easy :'(

bye
nono
-- 
View this message in context: http://www.nabble.com/-Newbie-Session-lost-in-an-AjaxFallbackLink-onClick%28%29-tp18016504p18036976.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: [Newbie]Session lost in an AjaxFallbackLink onClick()

Posted by A nono life <a....@gmail.com>.
hi

Johan Compagner wrote:
> 
> and that is your own object.
> So you clear it somewhere
> 
I'm sorry but I don't get where I could erase it. 

I add the AjaxFallbackLink in the same form and in the page I display the
creature's name and some of its characteristic and everything is rightly
present. It's just in the AjaxFallbackLink's onClick() that it fails... 

I did the following try in between :
- I rightly get the user and its content. So this part is properly working
- I've  tried the form's onSubmit, and there I get some part of my creature
data but not all of it (I get the name but not others attributes...).

Weird isn't it ????
Bye
Nono
-- 
View this message in context: http://www.nabble.com/-Newbie-Session-lost-in-an-AjaxFallbackLink-onClick%28%29-tp18016504p18034995.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: [Newbie]Session lost in an AjaxFallbackLink onClick()

Posted by Johan Compagner <jc...@gmail.com>.
and that is your own object.
So you clear it somewhere

On Fri, Jun 20, 2008 at 11:16 AM, A nono life <a....@gmail.com> wrote:

>
> Hi
>
> Johan Compagner wrote:
> >
> > which part is null?
> >
>
> It's the sessionCreature which is null, I get NullErrorException when
> trying
> to do something with it.
>
> My getSession().getUser() went without any hurdle.
>
> Thanks again
> ++
> Nono
> --
> View this message in context:
> http://www.nabble.com/-Newbie-Session-lost-in-an-AjaxFallbackLink-onClick%28%29-tp18016504p18025932.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: [Newbie]Session lost in an AjaxFallbackLink onClick()

Posted by A nono life <a....@gmail.com>.
Hi

Johan Compagner wrote:
> 
> which part is null?
> 

It's the sessionCreature which is null, I get NullErrorException when trying
to do something with it. 

My getSession().getUser() went without any hurdle.

Thanks again
++
Nono
-- 
View this message in context: http://www.nabble.com/-Newbie-Session-lost-in-an-AjaxFallbackLink-onClick%28%29-tp18016504p18025932.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: [Newbie]Session lost in an AjaxFallbackLink onClick()

Posted by Johan Compagner <jc...@gmail.com>.
which part is null?

On Thu, Jun 19, 2008 at 9:37 PM, A nono life <a....@gmail.com> wrote:

>
> Hi,
>
> When in an AjaxFallbackLink's onClick(), the object I retrieve from my
> session is null, even if in my form constructor the object was properly
> retrieved :
> public CreatureForm(String id, HibernateObjectModel object ) {
>        super(id,  object);
>        Creature sessionCreature = ((DemoUser) ((DemoSession)
> getSession()).getUser()).getCreature() ;
>        System.out.println("Creature name in the form : " +
> sessionCreature.getName());
>        System.out.println("Creature location : " +
> sessionCreature.getCurrentXP());
>        add(new AjaxFallbackLink("aLink"){
>         @Override
>         public void onClick(AjaxRequestTarget target) {
>                Creature sessionCreature = ((DemoUser) ((DemoSession)
> getSession()).getUser()).getCreature() ;
>                System.out.println("Creature name in the form : " +
> sessionCreature.getName());
>                System.out.println("Creature location : " +
> sessionCreature.getCurrentXP());
>         }
> }
>
> In the onClick, I get a java.lang.NullPointerException...
>
> What do I do wrong ?
>
> Thanks in advance
> ++
> Nono
> --
> View this message in context:
> http://www.nabble.com/-Newbie-Session-lost-in-an-AjaxFallbackLink-onClick%28%29-tp18016504p18016504.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>