Page Jump tips in Java Web development--new page opens in new window after jump

Source: Internet
Author: User

Recently learning Java Web, in the learning process to achieve a requirement, that is, when the JSP page jumps, I hope the new page after the jump opens in a new window,

Instead of covering the original page, this requirement puzzled me for a long time, and then, looking for a method on the Internet through a haystack, finally solved it,

Now this method to share with you, if there is a shortage of places, please forgive me, my original intention is to help people who have this need.

Before I have found a relatively reliable method on the Internet, is to add code in the corresponding location of the JSP page: target= "_black", such as

<a href= "Articleview?id=${article.id}" target= "_black" >${ARTICLE.TITLE}</A> the first click did play a role,

A successful new page is actually opened in a new window, but unfortunately, the second time you click on another connection, it overwrites the new window that was generated for the first time,

Did not generate a third new window, which makes people feel very depressed, using this method to achieve the above requirements is obviously not possible, then how to solve, the specific implementation method is as follows:

Use JS in the window.open () method to solve! Add the onclick attribute to the <a> tag and write this: onclick= "window.open (This.href); return false",

such as: <a href= "Articleview?id=${article.id}" onclick= "window.open (This.href); return false" >${article.title}< /a>,

So, the problem can be solved.

Reference: http://www.cnpc120.cn/pc/Article/Show27.html

Page Jump tips in Java Web development--new page opens in new window after jump

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.