This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Other Open Source Projects and the fly likes problem with Simple captcha implementation for sub folders directory Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "problem with Simple captcha implementation for sub folders directory" Watch "problem with Simple captcha implementation for sub folders directory" New topic
Author

problem with Simple captcha implementation for sub folders directory

sreenivas jeenor
Ranch Hand

Joined: Jan 09, 2005
Posts: 125
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

Joined: Oct 07, 2008
Posts: 1
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
 
Don't get me started about those stupid light bulbs.
 
subject: problem with Simple captcha implementation for sub folders directory