Re: getPageParameters() NullPointer

2008-03-16 Thread Sebastiaan van Erk

Hi,

I was actually trying to use getPageParameters() as well, and it was 
returning null too...


The reason I want to use it is, I have a base page which adds a context 
panel fragment in the page, which it gets by an abstract method 
getContextPanel(). Now in the sub page I wanted to use the state that 
was set in the constructor using the page parameters to build my context 
panel. But this does not work: the constructor of my sub page has not 
been called yet... the stack is:


MyPage.getContextPanel()
BasePage.init()
MyPage.init(PageParams params)

So I figured, I'd use getPageParams() in my context panel and explicitly 
initialize the state as a (very ugly) workaround. (If we get multiple 
wicket:child in 1.4 this problem is completely and nicely solved). If 
anybody knows a nicer way to work around this, let me know. (I'm 
actually against using overridable methods in constructors... but I see 
no alternative).


Anyway, checking the source code I noticed why getPageParams() returned 
null... I didn't do a super() call to my BasePage with the parameters, 
which in turn didn't do super() call to WebPage with the parameters... I 
just expected it to work. :-)


Maybe it would be useful to explicitly state in the getPageParams() 
method JavaDoc that you explicitly need to call the super() with the 
page parameters. :-)


Regards,
Sebastiaan

Martijn Dashorst wrote:

OK,
hangon...

You need to define a constructor *taking* a pageparameters object.

In that object you can find the parameters.

Martijn

On 1/22/08, Martijn Dashorst [EMAIL PROTECTED] wrote:

Stating the obvious, but did you check if the parameter was actually
present in the URL?

Martijn

On 1/22/08, Stephan Koch [EMAIL PROTECTED] wrote:

Hi all,

I'm experiencing a problem using getPageParameters().

The parameter id is passed to MyPage:
setResponsePage(MyPage.class, new PageParameters(id=+evalId));

In the constructor of MyPage I try to access the parameter id:
Integer evalId = Integer.parseInt(getPageParameters().getKey(id));

This fails with a NullPointerException. I thought the usage of
PageParameters was pretty straightforward- did I miss something here?

I'm using Wicket 1.3.

Regards,
Stephan




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--
Buy Wicket in Action: http://manning.com/dashorst
Apache Wicket 1.3.0 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0







smime.p7s
Description: S/MIME Cryptographic Signature


Re: getPageParameters() NullPointer

2008-03-06 Thread Johan Compagner


 in FirstLogin.java ---
 PageParameters params = new PageParameters();
 System.out.print(pid= + params.getKey(pid));--the output is
 null;how to get the parameter?


What are you doing here exactly?
Are you creating the PageParameters yourself?? in the FirstLogin page?
That is wrong. You should use the PageParameter constructor

johan


RE: getPageParameters() NullPointer

2008-03-05 Thread Maeder Thomas
Stephan, what you want is not PageParameters.getKey(id), but 
PageParameters.getInt(id);

@zhangjunfeng:

 PageParameters params = new PageParameters(); 
 System.out.print(pid= + params.getKey(pid));--the output is null

yes, the output is null, you just created a new, empty page parameters object. 
use Page.getPageParameters()

Thomas



 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
 Sent: Mittwoch, 5. März 2008 10:31
 To: users@wicket.apache.org
 Subject: Re:getPageParameters() NullPointer
 
  hello,i got the same problem.
  
PageParameters params = new PageParameters();
params.put(pid, pid);
this.setResponsePage(FirstLogin.class,
  new PageParameters(params));
  
 in FirstLogin.java ---
 PageParameters params = new PageParameters(); 
 System.out.print(pid= + params.getKey(pid));--the 
 output is null;how to get the parameter?
 
 
 在2008-01-22,Stephan Koch [EMAIL PROTECTED] 写道:
 
 Hi all,
 
 I'm experiencing a problem using getPageParameters().
 
 The parameter id is passed to MyPage:
 setResponsePage(MyPage.class, new PageParameters(id=+evalId));
 
 In the constructor of MyPage I try to access the parameter id:
 Integer evalId = Integer.parseInt(getPageParameters().getKey(id));
 
 This fails with a NullPointerException. I thought the usage 
 of PageParameters was pretty straightforward- did I miss 
 something here?
 
 I'm using Wicket 1.3.
 
 Regards,
 Stephan
 
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 


Re:RE: getPageParameters() NullPointer

2008-03-05 Thread zhangjunfeng21
 thanks,but there is no method of Page.getPageParameters(), how to use it ? 
may you show me in detial ?

 
 
 



Stephan, what you want is not PageParameters.getKey(id), but 
PageParameters.getInt(id);


 PageParameters params = new PageParameters(); 
 System.out.print(pid= + params.getKey(pid));--the output is null

yes, the output is null, you just created a new, empty page parameters object. 
use Page.getPageParameters()

Thomas



 Sent: Mittwoch, 5. März 2008 10:31
 To: users@wicket.apache.org
 Subject: Re:getPageParameters() NullPointer
 
  hello,i got the same problem.
  
PageParameters params = new PageParameters();
params.put(pid, pid);
this.setResponsePage(FirstLogin.class,
  new PageParameters(params));
  
 in FirstLogin.java ---
 PageParameters params = new PageParameters(); 
 System.out.print(pid= + params.getKey(pid));--the 
 output is null;how to get the parameter?
 
 
 
 Hi all,
 
 I'm experiencing a problem using getPageParameters().
 
 The parameter id is passed to MyPage:
 setResponsePage(MyPage.class, new PageParameters(id=+evalId));
 
 In the constructor of MyPage I try to access the parameter id:
 Integer evalId = Integer.parseInt(getPageParameters().getKey(id));
 
 This fails with a NullPointerException. I thought the usage 
 of PageParameters was pretty straightforward- did I miss 
 something here?
 
 I'm using Wicket 1.3.
 
 Regards,
 Stephan
 
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 


RE: RE: getPageParameters() NullPointer

2008-03-05 Thread Maeder Thomas
Yes there is, it's in Page.java at line 319 

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
 Sent: Donnerstag, 6. März 2008 03:11
 To: users@wicket.apache.org
 Subject: Re:RE: getPageParameters() NullPointer
 
  thanks,but there is no method of Page.getPageParameters(), 
 how to use it ? may you show me in detial ?
 
  
  
  
 
 
 
 Stephan, what you want is not PageParameters.getKey(id), 
 but PageParameters.getInt(id);
 
 
  PageParameters params = new PageParameters(); 
 System.out.print(pid= 
  + params.getKey(pid));--the output is null
 
 yes, the output is null, you just created a new, empty page 
 parameters object. use Page.getPageParameters()
 
 Thomas
 
 
 
  Sent: Mittwoch, 5. März 2008 10:31
  To: users@wicket.apache.org
  Subject: Re:getPageParameters() NullPointer
  
   hello,i got the same problem.
   
 PageParameters params = new PageParameters();
 params.put(pid, pid);
 this.setResponsePage(FirstLogin.class,
   new PageParameters(params));
   
  in FirstLogin.java ---
  PageParameters params = new PageParameters(); 
 System.out.print(pid= 
  + params.getKey(pid));--the output is null;how to get the 
  parameter?
  
  
  
  Hi all,
  
  I'm experiencing a problem using getPageParameters().
  
  The parameter id is passed to MyPage:
  setResponsePage(MyPage.class, new PageParameters(id=+evalId));
  
  In the constructor of MyPage I try to access the parameter id:
  Integer evalId = Integer.parseInt(getPageParameters().getKey(id));
  
  This fails with a NullPointerException. I thought the usage of 
  PageParameters was pretty straightforward- did I miss 
 something here?
  
  I'm using Wicket 1.3.
  
  Regards,
  Stephan
  
  
  
  
  
 -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  
  
 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



getPageParameters() NullPointer

2008-01-22 Thread Stephan Koch
Hi all,

I'm experiencing a problem using getPageParameters().

The parameter id is passed to MyPage:
setResponsePage(MyPage.class, new PageParameters(id=+evalId));

In the constructor of MyPage I try to access the parameter id:
Integer evalId = Integer.parseInt(getPageParameters().getKey(id));

This fails with a NullPointerException. I thought the usage of
PageParameters was pretty straightforward- did I miss something here?

I'm using Wicket 1.3.

Regards,
Stephan




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: getPageParameters() NullPointer

2008-01-22 Thread Martijn Dashorst
Stating the obvious, but did you check if the parameter was actually present
in the URL?
Martijn

On 1/22/08, Stephan Koch [EMAIL PROTECTED] wrote:

 Hi all,

 I'm experiencing a problem using getPageParameters().

 The parameter id is passed to MyPage:
 setResponsePage(MyPage.class, new PageParameters(id=+evalId));

 In the constructor of MyPage I try to access the parameter id:
 Integer evalId = Integer.parseInt(getPageParameters().getKey(id));

 This fails with a NullPointerException. I thought the usage of
 PageParameters was pretty straightforward- did I miss something here?

 I'm using Wicket 1.3.

 Regards,
 Stephan




 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




-- 
Buy Wicket in Action: http://manning.com/dashorst
Apache Wicket 1.3.0 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0


Re: getPageParameters() NullPointer

2008-01-22 Thread Martijn Dashorst
OK,
hangon...

You need to define a constructor *taking* a pageparameters object.

In that object you can find the parameters.

Martijn

On 1/22/08, Martijn Dashorst [EMAIL PROTECTED] wrote:

 Stating the obvious, but did you check if the parameter was actually
 present in the URL?

 Martijn

 On 1/22/08, Stephan Koch [EMAIL PROTECTED] wrote:
 
  Hi all,
 
  I'm experiencing a problem using getPageParameters().
 
  The parameter id is passed to MyPage:
  setResponsePage(MyPage.class, new PageParameters(id=+evalId));
 
  In the constructor of MyPage I try to access the parameter id:
  Integer evalId = Integer.parseInt(getPageParameters().getKey(id));
 
  This fails with a NullPointerException. I thought the usage of
  PageParameters was pretty straightforward- did I miss something here?
 
  I'm using Wicket 1.3.
 
  Regards,
  Stephan
 
 
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 


 --
 Buy Wicket in Action: http://manning.com/dashorst
 Apache Wicket 1.3.0 is released
 Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0




-- 
Buy Wicket in Action: http://manning.com/dashorst
Apache Wicket 1.3.0 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0


AW: getPageParameters() NullPointer

2008-01-22 Thread Stephan Koch
Yes, the parameter is present. The URL looks like

http://localhost:9080/myapp/app/?wicket:bookmarkablePage=%3Axxx.xxx.xxx.wick
et.MyPageid=135

-Ursprüngliche Nachricht-
Von: Martijn Dashorst [mailto:[EMAIL PROTECTED] 
Gesendet: Dienstag, 22. Januar 2008 12:13
An: users@wicket.apache.org
Betreff: Re: getPageParameters() NullPointer

Stating the obvious, but did you check if the parameter was actually present
in the URL?
Martijn

On 1/22/08, Stephan Koch [EMAIL PROTECTED] wrote:

 Hi all,

 I'm experiencing a problem using getPageParameters().

 The parameter id is passed to MyPage:
 setResponsePage(MyPage.class, new PageParameters(id=+evalId));

 In the constructor of MyPage I try to access the parameter id:
 Integer evalId = Integer.parseInt(getPageParameters().getKey(id));

 This fails with a NullPointerException. I thought the usage of
 PageParameters was pretty straightforward- did I miss something here?

 I'm using Wicket 1.3.

 Regards,
 Stephan




 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




-- 
Buy Wicket in Action: http://manning.com/dashorst
Apache Wicket 1.3.0 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



AW: getPageParameters() NullPointer

2008-01-22 Thread Stephan Koch
That was easy ;)

Thanks for your help.

Stephan

-Ursprüngliche Nachricht-
Von: Martijn Dashorst [mailto:[EMAIL PROTECTED] 
Gesendet: Dienstag, 22. Januar 2008 12:13
An: users@wicket.apache.org
Betreff: Re: getPageParameters() NullPointer

OK,
hangon...

You need to define a constructor *taking* a pageparameters object.

In that object you can find the parameters.

Martijn

On 1/22/08, Martijn Dashorst [EMAIL PROTECTED] wrote:

 Stating the obvious, but did you check if the parameter was actually
 present in the URL?

 Martijn

 On 1/22/08, Stephan Koch [EMAIL PROTECTED] wrote:
 
  Hi all,
 
  I'm experiencing a problem using getPageParameters().
 
  The parameter id is passed to MyPage:
  setResponsePage(MyPage.class, new PageParameters(id=+evalId));
 
  In the constructor of MyPage I try to access the parameter id:
  Integer evalId = Integer.parseInt(getPageParameters().getKey(id));
 
  This fails with a NullPointerException. I thought the usage of
  PageParameters was pretty straightforward- did I miss something here?
 
  I'm using Wicket 1.3.
 
  Regards,
  Stephan
 
 
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 


 --
 Buy Wicket in Action: http://manning.com/dashorst
 Apache Wicket 1.3.0 is released
 Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0




-- 
Buy Wicket in Action: http://manning.com/dashorst
Apache Wicket 1.3.0 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]