Can we redirect one jsp page to another jsp page

Brain picture Brain · May 7, 2014 · Viewed 81.6k times · Source

I want to open a jsp page without accessing my servlete code. i.e. I neither have to input my url in (action="url") my jsp code nor have to access my Servlete code.

<form id="main" method="post" name="main" action="dpRegPost" onsubmit="return validate();">

Can anyone help me in this?

Answer

Mustafa sabir picture Mustafa sabir · May 7, 2014

You can add javascript to your jsp file

<script type="text/javascript">
window.location.href = "www.google.com";
</script>

or using jsp

<%

    response.sendRedirect("www.google.com");
%>