HI,
I need to have a captcha in my jsp page. The captcha code is ready and it works perfectly well when the user enters the value. It reloads the same page if the captcha enterd is wrong. I need to navigate to the next page if the value is correct. The varification of wthr the user inout matches the image is done as soon as user submits the captcha. How will I add the code to navigate to the next page once the captcha is right.
My code is
<form id="id" method="post">
<div id="body-right">
<table align="right" cellspacing="15">
<tr>
<td>PLEASE TYPE THE TEXT IN THE IMAGE</td>
<tr>
<td><input type="text" name="code" autocomplete="off"></td></tr>
<tr><td><img src="http://localhost:12957/TESTROI/CaptchaServlet"></td></tr>
<tr><td><input type="submit" value="SUBMIT"></td></tr>
</table>
<br>
<br><br>
</div>
</form>
The verification goes to a servelt wr I have implemented the servlet. Its in jsp. code follows :
<%
out.println("<div id=\"gtwo\">");
String captcha = (String) session.getAttribute("captcha");
String code = (String) request.getParameter("code");
out.println("<form id=\"id\" method=\"post\" action=\"http://localhost:12957/TESTROI/index.jsp\">");
if (captcha != null && code != null) {
if (captcha.equals(code)) {
out.print("<p>YOU CAN CONTINUE TO THE STORE PARAMETERS PAGE!!</p>");
out.println("<input type=\"submit\" value=\"STORE PARAMETERS\">");
} else {
out.print("<p class='alert'>WRONG ENTRY!!! TRY AGAIN!!</p>");
}
out.println("</form>");
}
%>
As if now I have kept a submit button which is displayed only when captcha is correct. But I need to remove this and navigate automatically to the page if the input is corect
Could anyone help?
Thanks in advance!! :)