Reputation: 1744
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?
Upvotes: 5
Views: 90926
Reputation: 1
use the following code to redirect on another page in js...
$('#abc_id').click(function() {
updateSubContent("abc.jsp");
});
Upvotes: 0
Reputation: 3854
Try this:
<form id="main" method="post" name="main" action="" onsubmit="redirect(this);">
<input type="submit" name="submit"/>
</form>
function redirect(elem){
elem.setAttribute("action","somepage.jsp");
elem.submit();
}
Upvotes: 2
Reputation: 4539
You can also call page directly with:
<jsp:redirect page="xyz.jsp" />
Upvotes: 1
Reputation: 4360
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");
%>
Upvotes: 8
Reputation: 535
Use jstl taglibrary in your current jsp page.Make available the taglibrary using below code
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
Use Following code in jsp to redirect
<c:redirect url="/xxx.jsp"/>
Upvotes: 3