| Author |
conditional redirect
|
Shawn Kuenzler
Ranch Hand
Joined: Apr 16, 2006
Posts: 73
|
|
I need to redirect my JSP based on whether the the parent window has a certain name. I wrote up a simple JSP with javascript to do what I want. It doesn't work but you get the idea for what I'm looking for. Anyone care to share the best way to do this? Or help me fix whatever its doing wrong here? Thanks! (Notice "onLoad" is spelled incorrectly because javaranch won't allow me to post with that syntax in my own code.)
|
SCJP 1.5
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56192
|
|
response.sendRedirect() is not JavaScript, it's Java. You can't mix server-side Java with client-side JavaScript. Do the redirect using JavaScript. [ July 03, 2007: Message edited by: Bear Bibeault ]
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56192
|
|
|
P.S. Using the "javascript:" prefix in your onload attribute will get you into trouble with most browsers. Remove it as unnecessary.
|
 |
 |
|
|
subject: conditional redirect
|
|
|