Open new window behaves a bit different?

Hi,

getWindow().open(ExternalResource) seems behave a bit different than , can some one elabrate or confirm?

I am calling an external page (from which team I cannot get any support). I tried to understand their code but I can only view the html. It seems they have a searchsubmit.jsp page which takes the id=XXXXX and forward to the next page, say data.jsp. The data.jsp page takes no parameter, but it shows the data relates to id=XXXXX, so I guess they opened the session (or cookie) when calling searchsubmit page, so the data.jsp page understand this id.

Okay, then my problem starts.

Solution1, I use a nativebutton (link style) in my own page. When it is clicked, I call

getWindow().open(new ExternalResource(“http://…/searchsubmit.jsp?id=XXXX”), “mypage”);
getWindow().open(new ExternalResource(“http://…/data.jsp”), “mypage”);

i use name “mypage”, because user just see one page get opened.

The VERY strange thing is that, this solution only works on the second time user clicks my button. The first time they click the button shows the data.jsp page, but it seems there is no id connected (an empty page with no data). I tried Thread.sleep or call these two lines many times, it didn’t work.

Solution2, I use a Label, XHTML mode, the content is . This works, but I cannot use it. Because I have data1.jsp, data2.jsp and data3.jsp. The searchsubmit.jsp only forward to the data1.jsp. (there is no link between these pages). I don’t want to use the ugly javascript.

Is there any other solution. And anyone knows why the open() function does not work for the first time. I am sorry I don’t know anything about the external site. I could only guess their work. Any help is appreciated!

Br,
Xuan

Now I have some new discover. It seems I SHOULD NOT call

getWindow().open(new ExternalResource("http://...../searchsubmit.jsp?id=XXXX"), "mypage");
getWindow().open(new ExternalResource("http://...../data.jsp"), "mypage");

The session in Line 1 is not carried on to Line2. So I will ask the question this way:

How am I able to open two URL links from Vaadin while they share the same session/cookie?

Br,
Xuan

You’re a bit off with your observations, I think. The session would be the same, but the reason why this doesn’t work, is because the two open commands are executed directly after each other in the client side, so the first one newer gets time to load. You would need to add the “sleep” command in the client side between the two open operations, but that’s not possible to do on the client side.

What I think I would probably try, is open the first page normally, but use a thread to open the second one a bit later (maybe 1 second). The I would use either a ProgressIndicator to pull the second change from the server, or use one of the push add-ons from the Directory.