Java Mailing List Archive

http://www.junlu.com/

Google
Google
Mailing List
Home
Forum Home
JBoss - Java Application Server
Tomcat - JSP/Servlet container
Struts - A MVC web framework
iText - An open source PDF Java Library
JDOM - JDOM XML Parser
JSP - A mailing list about Java Server Pages specification and reference
J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition
J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog
Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology
Struts & Hibernate
Subjects
JSP editor plugin for eclipse ?
org apache jasper JasperException: Unable to compile class for JSP
Tomcat: Connection reset by peer: socket write error
Cannot retrieve definition for form bean null
Struts Tiles Tutorial (free Struts training)
Where do I download Tomcat 4 0 6?
Data Access Object (DAO) pattern, example DAO 's
Where to download Tomcat v 4 1 24 from?
Tomcat 5 0 16 Requested resource not available
Subject: Servlet : Session invalidate
Oracle Connection Pooling in 3 2 2
Servlet action is currently unavailable
Tomcat/Struts Unicode Encoding/Decoding problems
Subject: Running a Simple JMS Example
Tomcat and webapplication specific java library path
Mapping in workers2 properties
org apache jasper JasperException
problem with html:text bean throwing exception
Cannot find message resources under key org apache struts action
   MESSAGE
Cannot find message resources under key org apache struts action MESSAGE
invalid direct reference problem with solution
Tool for jsp debug Try Sysdeo Eclipse Plugin
Tomcat 5 Cannot load JDBC driver class 'null ' SQL state: null
weblogic ejbc
java properties file
Jboss 3 2 3 Coyote Can 't re
Tomcat 5, Apache2 and mod jk2 integration problem
JBoss example problem new to J2EE
Value attribute of <html:checkbox
url string for connecting jboss to oracle
javax servlet ServletException: BeanUtils populate
5 0 18: Windows XP Pro vs Windows 2000
HTTP Status 404 The requested resource is not available
 
Subject: JCaptcha + Struts problem

Subject: JCaptcha + Struts problem

2007-10-03       - By alee amin

 Back
Hi,

I am using JCaptcha for captcha features. It is working fine. I have this
code in CaptchaServlet and this code save the captcha in request


   public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {

       ImageCaptcha pixCaptcha = factory.getImageCaptcha();
       BufferedImage bi = pixCaptcha.getImageChallenge();
       resp.setContentType("image/jpg");
       JPEGImageEncoder jpegEncoder = JPEGCodec.createJPEGEncoder(
resp.getOutputStream());

       jpegEncoder.encode(bi);
       resp.flushBuffer();

       req.getSession().setAttribute("pixCaptcha", pixCaptcha);
   }


Now, i get this captcha in form Action from req and validate it etc.

In that form i set the following header for the JSP page


response.setHeader("Pragma","no-cache"); //HTTP 1.0
response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
response.setDateHeader ("Expires", 0); //pr


So that my captcha does not remain in cache. Now there is one issue. If i
keep the page open for 10-15 minutes and after that i submit it, the
actionform does not find any captcha (ok fine - make sense). The page is
re-displayed but it display with the LAST CAPTCHA (it does not generate the
new one) or at least generate the new one but does not show it.

So what coould be possible modification should i made so that my PAGE
GURANTEE to show the new CAPTCHA IMAGE each time it loads (F5 or CTRL + F5).

-alee
--
Muhammad Ali
http://techboard.wordpress.com
Software Engineer - E2ESP
muhammadaliamin(at)gmail(dot)com

©2008 junlu.com - Jax Systems, LLC, U.S.A.