Reputation: 47
How can i open the URL in new window or tab when written the code in spring controller class. Below is the code:
@RequestMapping(value = "/showPage", method = RequestMethod.GET)
public ModelAndView openDataLink(HttpServletRequest request, HttpServletResponse response, BindException errors) throws Exception {
//logic to get or construct the URL
return new ModelAndView(new RedirectView("http://www.google.com"));
}
From my application when i access the contoller, google.com is getting opened in the same window from where i'am accessing the application. How can i make google.com open in new window or tab when accessing controller form my application. Please suggest.
Upvotes: 2
Views: 11071
Reputation: 9303
Opening a new window will have to be done by the browser via html (<a target="blank_">
) or javascript. Java and/or Spring have nothing to do with this.
Upvotes: 1
Reputation: 174
Refer to this solution if you want to achieve this from the jsp where you are submitting form to the controller:
How to open new tab of same browser while submit jsp form
Upvotes: 0