Usually this happens when you try to use getPage in the constructor of
you panel, however in that case i find the stacktrace with the
bookmarkablepagerequesttarget a bit odd.
Is the panel at the time of invocation attached to a page at all?
Usually you should be able to use getPage in the event phase (unless
your component has just been removed from its parent)
An alternative solution would be to pass the parent page at
construction time as a parameter of your panels constructor.

Maurice

On Dec 25, 2007 5:22 PM, Artur W. <[EMAIL PROTECTED]> wrote:
>
> Hi!
>
> I want to create a Panel that its content depends to which page it was
> added.
>
> So I want to do something like this
>
> if (getPage().getPageClass() == Page1.class) {
>     [...]
> } else if (getPage().getPageClass() == Page2.class) {
>     [...]
> } else {
>     [...]
> }
>
> and so on.
>
> But when I call getPage() I get
>
> org.apache.wicket.WicketRuntimeException: Can't instantiate page using
> constructor public com.test.AdminPage(org.apache.wicket.PageParameters) and
> argument
>         at
> org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:175)
>         at
> org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:66)
>         at
> org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.newPage(BookmarkablePageRequestTarget.java:262)
>         at
> org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.getPage(BookmarkablePageRequestTarget.java:283)
>         at
> org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.processEvents(BookmarkablePageRequestTarget.java:210)
>         at
> org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:90)
>         at
> org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1094)
>
> [...]
>
> Caused by: java.lang.IllegalStateException: No Page found for component
> [MarkupContainer [Component id = menuPanel, page = <No Page>, path =
> menuPanel.AdminPage$3]]
>         at org.apache.wicket.Component.getPage(Component.java:1600)
>
>
>
> How can I do this? (I use Wicket 1.3rc2)
>
>
>
> Thanks,
> Artur
>
> --
> View this message in context: 
> http://www.nabble.com/getPage%28%29-throws-IllegalStateException%3A-No-Page-found-for-component-tp14496019p14496019.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> 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]

Reply via email to