This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one 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


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
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: 917
    
  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...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to open new jsp page in current tab by click on menu?