tag:blogger.com,1999:blog-4604699843198276393.post4184482450612661542..comments2024-03-15T00:32:00.571-07:00Comments on Osama Oransa's Blog: Simple Captcha with StrutsOsama Oransahttp://www.blogger.com/profile/03508436445550571265noreply@blogger.comBlogger20125tag:blogger.com,1999:blog-4604699843198276393.post-40181917400515695092012-05-07T08:24:00.458-07:002012-05-07T08:24:00.458-07:00You must put the context root before custom captch...You must put the context root before custom captch in img src=.... as described in the post.Osama Oransahttps://www.blogger.com/profile/03508436445550571265noreply@blogger.comtag:blogger.com,1999:blog-4604699843198276393.post-91016701954997439692012-05-07T06:30:43.865-07:002012-05-07T06:30:43.865-07:00I Created my servlet CustomCaptcha.java and added ...I Created my servlet CustomCaptcha.java and added doGet(), as mentioned. I included this in my web.xml too. Lastly, in my JSP, i'm using image source = customCaptcha.png,but no image gets displayed on JSP.<br /><br />Am i missing out on anything?Neetunoreply@blogger.comtag:blogger.com,1999:blog-4604699843198276393.post-81369789625878012812012-04-05T01:54:24.875-07:002012-04-05T01:54:24.875-07:00oh sorry i thought you wrote that class for only v...oh sorry i thought you wrote that class for only validation <br />of captcha response.little confusion in my thinking.venuhttps://www.blogger.com/profile/09446618586080869528noreply@blogger.comtag:blogger.com,1999:blog-4604699843198276393.post-90145614795239107102012-04-05T01:50:31.484-07:002012-04-05T01:50:31.484-07:00It is amazing, you should know struts before askin...It is amazing, you should know struts before asking, in Struts the html field get populated in this bean that is mapped to that JSP file.. so i am getting the value directly from it, you need to get it same way as you do in spring.Osama Oransahttps://www.blogger.com/profile/03508436445550571265noreply@blogger.comtag:blogger.com,1999:blog-4604699843198276393.post-75051407595840626292012-04-05T01:45:11.319-07:002012-04-05T01:45:11.319-07:00sir then what about this registerFormBean.getCaptc...sir then what about this registerFormBean.getCaptchaResponse(),did you initialize captcharesponse field with anything.please post the intialization of captcharesponse field.venuhttps://www.blogger.com/profile/09446618586080869528noreply@blogger.comtag:blogger.com,1999:blog-4604699843198276393.post-65061384386886827692012-04-05T01:37:45.518-07:002012-04-05T01:37:45.518-07:00The correct answer is in the session: String answe...The correct answer is in the session: String answer = request.getSession().getAttribute("CorrectAnswer");<br /><br />& you need to compare it with the sent parameter in the request that correspond to the field name/backing bean..Osama Oransahttps://www.blogger.com/profile/03508436445550571265noreply@blogger.comtag:blogger.com,1999:blog-4604699843198276393.post-31370206001404877732012-04-05T00:44:01.772-07:002012-04-05T00:44:01.772-07:00Hi Osama sir ,do you have any idea how to validate...Hi Osama sir ,do you have any idea how to validate this captcha response value in spring security login .please help me i want to validate this response value while authenticating the login credentials,or other wise please post your full validation action class so that i can understand the logic there.please help me sir<br /><br />Thanksvenuhttps://www.blogger.com/profile/09446618586080869528noreply@blogger.comtag:blogger.com,1999:blog-4604699843198276393.post-334194869192808102012-04-02T02:01:33.004-07:002012-04-02T02:01:33.004-07:00You are welcome :)You are welcome :)Osama Oransahttps://www.blogger.com/profile/03508436445550571265noreply@blogger.comtag:blogger.com,1999:blog-4604699843198276393.post-74094038791175957512012-04-02T01:46:25.783-07:002012-04-02T01:46:25.783-07:00Its working for me i just added
a href="#&qu...Its working for me i just added <br />a href="#" title="Refresh Captcha" onclick="document.getElementById('captcha').src = 'simpleCaptcha.jpg?sid=' + Math.random(); return true"<br /> below default generating captcha.i really thank you so much for your valuable time and support .by talking with you i got this idea.once again thanks a lotvenuhttps://www.blogger.com/profile/09446618586080869528noreply@blogger.comtag:blogger.com,1999:blog-4604699843198276393.post-35356169046532322102012-04-02T01:40:35.216-07:002012-04-02T01:40:35.216-07:00Please read the post carefully and follow the step...Please read the post carefully and follow the steps!<br />This refer to this image:<br /><img id="captchaImg" src="/...context..../CaptchaServlet" alt="Captcha Image" height="45">Osama Oransahttps://www.blogger.com/profile/03508436445550571265noreply@blogger.comtag:blogger.com,1999:blog-4604699843198276393.post-68842609267199139652012-04-02T01:35:02.952-07:002012-04-02T01:35:02.952-07:00sir i am confusing about your onclick functionalit...sir i am confusing about your onclick functionality<br />onclick="document.forms[0].captchaImg.src='/...context..../CaptchaServlet?id='+Math.random();" ,what is that code document.forms[0].captchaImg.src you wrote any script for that functionality.venuhttps://www.blogger.com/profile/09446618586080869528noreply@blogger.comtag:blogger.com,1999:blog-4604699843198276393.post-41171041379532165262012-04-02T01:26:25.833-07:002012-04-02T01:26:25.833-07:00OK, please follow my blog post and create this wra...OK, please follow my blog post and create this wrapper servlet and use it instead..Osama Oransahttps://www.blogger.com/profile/03508436445550571265noreply@blogger.comtag:blogger.com,1999:blog-4604699843198276393.post-20252679547633013842012-04-02T00:23:11.033-07:002012-04-02T00:23:11.033-07:00Actually i didn't write any own servlet i just...Actually i didn't write any own servlet i just added this in web.xml and simplecaptcha-1.1.1.jar to buildpath<br /><br /> SimpleCaptcha<br /> com.manam.captcha.servlet.SimpleCaptchaServlet <br /> <br /> <br /> SimpleCaptcha<br /> /simpleCaptcha.jpg<br /> <br /><br />in login.jsp the below line under password field<br /><br />img id="captcha" src="" width="75"<br /><br />the above line is generating me the captcha image with textvenuhttps://www.blogger.com/profile/09446618586080869528noreply@blogger.comtag:blogger.com,1999:blog-4604699843198276393.post-41616667649229292202012-04-02T00:18:24.620-07:002012-04-02T00:18:24.620-07:00replace /...context.../images/reload.jpg with your...replace /...context.../images/reload.jpg with your image path and replace /..context../CaptchaServlet with your CapchaServlet path ..<br />Context=Context Root of the application.Osama Oransahttps://www.blogger.com/profile/03508436445550571265noreply@blogger.comtag:blogger.com,1999:blog-4604699843198276393.post-77252178813953620982012-04-01T23:50:18.981-07:002012-04-01T23:50:18.981-07:00In jsp file this part of refresh button
img src=...In jsp file this part of refresh button <br /><br />img src="/...context..../images/reload.jpg" alt="Reload" onclick="document.forms[0].captchaImg.src='/...context..../CaptchaServlet?id='+Math.random();" style="cursor:pointer"venuhttps://www.blogger.com/profile/09446618586080869528noreply@blogger.comtag:blogger.com,1999:blog-4604699843198276393.post-39751770754536980772012-04-01T23:46:48.529-07:002012-04-01T23:46:48.529-07:00Which part is confusing for you so i can put the c...Which part is confusing for you so i can put the code ?Osama Oransahttps://www.blogger.com/profile/03508436445550571265noreply@blogger.comtag:blogger.com,1999:blog-4604699843198276393.post-78866005834863881182012-04-01T23:35:28.583-07:002012-04-01T23:35:28.583-07:00Hi sir i implementes this simplecaptcha in my spri...Hi sir i implementes this simplecaptcha in my spring login application ,every thing works fine ,but i need to add refresh button i am not able to do it,but i saw your example but it is litte bit confusion.if you have source code please make it available for download. please help me ,venuhttps://www.blogger.com/profile/09446618586080869528noreply@blogger.comtag:blogger.com,1999:blog-4604699843198276393.post-69457381900792257862012-01-19T10:01:40.887-08:002012-01-19T10:01:40.887-08:00hi sir,
this is really goood.
sir, i facing a prob...hi sir,<br />this is really goood.<br />sir, i facing a problem for few days . hope you can give an answer.<br /><br />how to conditionally populate drop down list.Like countries in one drop down list and when i select a country corresponding list og states is shown in other .<br /><br />i can do it using javascript but do not know i to do it using struts.<br /><br />if you might write a blog on same, it will be of great help.amit ratheehttps://www.blogger.com/profile/11931302145221149918noreply@blogger.comtag:blogger.com,1999:blog-4604699843198276393.post-67591821315956220602011-09-09T13:24:00.057-07:002011-09-09T13:24:00.057-07:00Thanks a ton! I really a quick solution and ur pos...Thanks a ton! I really a quick solution and ur post helped me :)Amit Herlekarhttps://www.blogger.com/profile/00602848175222451813noreply@blogger.comtag:blogger.com,1999:blog-4604699843198276393.post-36844228330334685022010-10-26T11:02:06.101-07:002010-10-26T11:02:06.101-07:00Thanks for posting! I needed help getting my capt...Thanks for posting! I needed help getting my captcha to reload and this worked very nicely.Anonymousnoreply@blogger.com