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: [email protected]
> 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]
>
>