Re: Opening a stateful page in a new window/tab with ajax

2019-11-22 Thread mscoon
Thanks for the prompt answer.

On Thu, Nov 21, 2019 at 6:38 PM Sven Meier  wrote:

> Hi,
>
> that's a perfectly valid usage.
>
> Have fun
> Sven
>
>
> On 21.11.19 13:44, mscoon wrote:
> > Hi all,
> >
> > We are using the following code inside an ajax callback to create a new
> > page and open it in a new window. Are there any gotchas with respect to
> how
> > we create MyPage and get the url for it? Is it guaranteed to be found in
> > the user's session when the request for it comes in?
> >
> > void openPageInNewWindow(AjaxRequestTarget target) {
> >  Page pg = new MyPage();
> >  String url = urlFor(new RenderPageRequestHandler(new
> > PageProvider(pg))).toString();
> >   target.appendJavaScript("window.open(\"" + url + "\")");
> > }
> >
> > Is there a better way to do this?
> >
> > Note that we don't want to use a BookmarkablePage page as an alternative.
> > We want the new page to be instantiated inside the ajax callback.
> >
> > Thank you in advance,
> > Marios
> >
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Opening a stateful page in a new window/tab with ajax

2019-11-21 Thread Sven Meier

Hi,

that's a perfectly valid usage.

Have fun
Sven


On 21.11.19 13:44, mscoon wrote:

Hi all,

We are using the following code inside an ajax callback to create a new
page and open it in a new window. Are there any gotchas with respect to how
we create MyPage and get the url for it? Is it guaranteed to be found in
the user's session when the request for it comes in?

void openPageInNewWindow(AjaxRequestTarget target) {
 Page pg = new MyPage();
 String url = urlFor(new RenderPageRequestHandler(new
PageProvider(pg))).toString();
  target.appendJavaScript("window.open(\"" + url + "\")");
}

Is there a better way to do this?

Note that we don't want to use a BookmarkablePage page as an alternative.
We want the new page to be instantiated inside the ajax callback.

Thank you in advance,
Marios



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



Opening a stateful page in a new window/tab with ajax

2019-11-21 Thread mscoon
Hi all,

We are using the following code inside an ajax callback to create a new
page and open it in a new window. Are there any gotchas with respect to how
we create MyPage and get the url for it? Is it guaranteed to be found in
the user's session when the request for it comes in?

void openPageInNewWindow(AjaxRequestTarget target) {
Page pg = new MyPage();
String url = urlFor(new RenderPageRequestHandler(new
PageProvider(pg))).toString();
 target.appendJavaScript("window.open(\"" + url + "\")");
}

Is there a better way to do this?

Note that we don't want to use a BookmarkablePage page as an alternative.
We want the new page to be instantiated inside the ajax callback.

Thank you in advance,
Marios