This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Servlets and the fly likes javascript in jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "javascript in jsp" Watch "javascript in jsp" New topic
Author

javascript in jsp

Pradeep Baisani
Greenhorn

Joined: May 23, 2001
Posts: 2
Hi,
I am trying to open a new page in jsp using response.sendRedirect('url')
As, the url should be opened in a diffrent browser, in jsp I have used some javascript which takes the url and opens in a new browser. But, response.sendRedirect("javascript:windowOpen('url');") is showing an error page.
Would some one suggest me how to open a new page in a new window from jsp.
Thanks,
Deep.
Mark Simms
Ranch Hand

Joined: Jul 20, 2000
Posts: 36
The Javascript only acts if placed within the CALLED url.
In the CALLING JSP:
<%
url = url+"#popup; // indicate a pop-up (new) window is needed
response.sendRedirect(url);
%>
In the CALLED JSP, make sure this code is present:
<script>
if (window.location.hash=="#popup")
window.open(window.location)
</script>


Mark
 
 
subject: javascript in jsp
 
Similar Threads
Pass parameters with response.sendRedirect
HttpRequest carry-over
Calling a JSP using Swing
Page Redirection in a JSP
How can I control the window size in a JSP page?