URL redirect errors

I am trying to use a simple redirect command that will direct users to a new web page based upon a pre-defined condition. When the script runs the condition is recognized and IE attempts the redirect but i get an error saying Error: Object Expected. here is my code. I have also tried using the response.sendRedirect and res.sendRedirect commands and I get a message saying 'response' is undefined. please help.

if (browser != "Microsoft Internet Explorer")

{

redirect("http://myserver.com/xyz.html");

}

thanks,

Matt

[562 byte] By [matt_chabota] at [2007-9-27 9:53:07]
# 1

If you are using a servlet try

public void doGet (HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {

res.sendRedirect("your page");

}

in a jsp page response.sendRedirect("your page"); should do it.

P.S.: You should use "if(!browser.equals("Microsoft Internet Explorer")) {}" instead of !=

madboy108a at 2007-7-8 23:35:20 > top of Java-index,Archived Forums,Java Programming...
# 2

Are you trying to do this using Java or JavaScript?

I would do this using the JavaScript shown in context below

<html>

<head>

<!-- the Script starts here-->

<SCRIPT Language="JavaScript">

var navName = navigator.appName;

if(navName != "Microsoft Internet Explorer")

{

window.location="http://www.myserver.com/abc/html";

}

</SCRIPT>

<!--and ends here-->

</head>

</html>

and97020a at 2007-7-8 23:35:20 > top of Java-index,Archived Forums,Java Programming...
# 3
thank you very much, that did exactly what I wanted it to. You rule!!
matt_chabota at 2007-7-8 23:35:20 > top of Java-index,Archived Forums,Java Programming...