aspose file tools*
The moose likes JSP and the fly likes want to open response.sendRedirect in a new window Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "want to open response.sendRedirect in a new window" Watch "want to open response.sendRedirect in a new window" New topic
Author

want to open response.sendRedirect in a new window

Prasenjit Das
Greenhorn

Joined: Aug 12, 2003
Posts: 10
hi folks,
i am using this line in my code
response.sendRedirect("http://www.google.com/search?q="+str_search+" + Maharashtra + India");
this works, I want to open this in a new window. so i tried like this -
response.sendRedirect("%><script language="javascript">window.open("http://www.google.com/search?q="<%=str_search%>" + Maharashtra + India")</script><%");
but this is giving me the following errors :
Error(29,33): illegal character
Error(29,33): unclosed character literal
Error(29,158): unclosed character literal
Error: malformed expression
I am not being able to correct.
Can anybody help me regarding this.
Thanks a lot in advance.
regards,
Prasen
Navin Thr
Greenhorn

Joined: Nov 08, 2002
Posts: 2
just make a few changes to your view.
try putting in the target attribute
if it is a form submit action,
<form method="post" action="someAction" target="_blank">
if it is a link,
<a href="someAction?key=value" target="_blank">Click here</a>
Regards,
Navin
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61761
    
  67

As Navin indicated, you must target the original request to the window in which you want the response to appear. Once the request has been made, there is no way to change the window in which its response will be displayed.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Prasenjit Das
Greenhorn

Joined: Aug 12, 2003
Posts: 10
GREAT GUYS!!! IT WORKS!!!
So, is it like a mantra- that whenever u want to open the request.sendRedirect in a new window put in the target attribute inside the form tag.
Thanks a lot,
Cheers.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: want to open response.sendRedirect in a new window