开发者

Linking two pages using JSP

So, I am trying to use JSP to create a set of webpages. I want to link two pages so that if the user clicks a button in one page, it will trigger an event in the other page. Is there an efficient way to do this?

I was taking a look at creating cookies and/or sessions. Any suggestions on these two methods? Thanks

Edit: The second page that is affected by the button click on the first page should already be open. I do not want a new tab to come up when I click the button on the first page. If the responding page is not open, nothing should happen.开发者_如何学Go


If it are two independent pages, your best bet is to use either HTTP push (read on about "Comet") or Ajax poll. I only question why you were explicitly asking for linking two pages (and not three or more), so those pages must be somehow related to each other. If the second page is actually opened by for example Javascript window.open(), then you can make use of the window instance to access the second page and the window.opener property to access the parent page from the second page.

JSP as being a view technology can't do much for you here since it is just there to generate and send all the necessary HTML/CSS/JS, if not with help of taglibs and/or EL to access the "backend" Java code.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜