This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes JSP and the fly likes How to open new jsp page in current tab by click on menu? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » JSP
Bookmark "How to open new jsp page in current tab by click on menu?" Watch "How to open new jsp page in current tab by click on menu?" New topic
Author

How to open new jsp page in current tab by click on menu?

Sumit Sonone
Greenhorn

Joined: Oct 02, 2013
Posts: 4
<td class="bottomlinks"><a href="home.jsp">Homepage</a></td>

This is my menuitem. When i click on menu then it opens a new jsp page in the new tab and current tab still remains. I want to close current page and open new page in current tab. Please someone help me...
J. Kevin Robbins
Bartender

Joined: Dec 16, 2010
Posts: 983
    
  13

That's controlled two ways. By the "target" attribute of the href element, and by the browser settings. Since you aren't using the target attribute, the link should open in the same window. If it isn't, that means the browser is configured to open links in a new tab and you have no control over that unless you use Javascript in your links instead of standard html. If you want to try that tactic, search on "location.href" for tips.


"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." -- Ted Nelson
Sumit Sonone
Greenhorn

Joined: Oct 02, 2013
Posts: 4
What should i write in the <script> tag and where it should be placed.
Sumit Sonone
Greenhorn

Joined: Oct 02, 2013
Posts: 4
I got the answer. It should be like <td class="toplinks"><a href="home.jsp">Homepage</a></td>
The target attribute should not be included.
Thanks for response...
 
GeeCON Prague 2014
 
subject: How to open new jsp page in current tab by click on menu?