Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem with Simple captcha implementation for sub folders directory

 
sreenivas jeenor
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I Have to Implement Captcha in my project.

For this I have downloaded source from http://sourcefourge.net/projects/simpleCatcha, which is a Captcha code generator and validator.

When I Place SimpleCapchaExample.jsp in directly into my application folder it works fine.
The Problem lies when I want to Place SimpleCapchaExample.jsp in /jsp/Login/ folder of my Application.
The Page Doesnot show any captcha image or i get a session variable
How should i ssolve this problem

SimpleCapchaExample.jsp
---------------------

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<%@ page
language="java"
contentType="text/html; charset=ISO-8859-1"
%>
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META name="GENERATOR" content="IBM WebSphere Studio">
<TITLE>SimpleCapchaExample.jsp</TITLE>
</HEAD>
<BODY>


<br><br><br><br>

<%

String c= (String)session.getAttribute(nl.captcha.servlet.Constants.SIMPLE_CAPCHA_SESSION_KEY) ;
String parm = (String) request.getParameter("captchafield");

out.println(parm + " ? " + c + ":");

if (c != null && parm != null) {
if (c.equals(parm)) {
out.println("<b>true</b>");
}else {
out.println("<b>false</b>");
}
}



%>




<table>
<tr>
<td><img src="Captcha.jpg"></td>
<td valign="top">
<form>
<br>sec code:<input type="text" name="captchafield"><br>
<INPUT type="submit" name="submit">
</form></td>
</tr>
</table>




</BODY>
</HTML>
--------------------------

Please solve my problem

Thanks
Sreenivas
 
Andrej Szolgay
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

Maybe there is a problem in web.xml - try define captcha servlet's url-pattern like following /jsp/Login/Captcha.jpg

or try set url-pattern to /Captcha.jpg and use image definition

BR
Andrej
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic