Asme Just Asme Just - 2 months ago 10
Java Question

Automatic redirection to a servlet from a JSP page

Is there a way to auto redirect to a servlet from a JSP page?

I know it's possible to do this to another JSP like this:

<% response.addHeader("Refresh","4;./nexPage.jsp"); %>


This code will redirect to nexPage.jsp after 4 seconds.

But I want it to redirect to a given servlet instead.

Answer

Can you please check with this.

<meta http-equiv="refresh" content="5;URL=/servleturl">

This will redirect to the given servlet url after 5 seconds. place this tag between your head tag. But i think this is not SEO friendly.

Comments