aspose file tools*
The moose likes Struts and the fly likes JCaptcha and Struts problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "JCaptcha and Struts problem" Watch "JCaptcha and Struts problem" New topic
Author

JCaptcha and Struts problem

Em Aiy
Ranch Hand

Joined: May 11, 2006
Posts: 226
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



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



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).


The difference between <b>failure</b> and <b>success</b> is often being <b>right</b> and being <b>exactly right</b>.
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30324
    
150

Muhammad,
Is using POST an option? That would force a trip to the server where you could create a new captcha.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Em Aiy
Ranch Hand

Joined: May 11, 2006
Posts: 226
I am using this code in CaptchaServlet POST method



Here is the code i have writen in action form, which validate the captcha


Now, when the exception occurs, it sends back to the url with "ERROR" message and it does not update the captcha (most of the time).
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: JCaptcha and Struts problem