473,324 Members | 2,535 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Reloading page on servlet response

9
Hi Guys,

I have a servlet which determines if the user entered a valid captcha,
If the captcha is correct the request is forwarded to another servlet which inputs the form data to a DB.
if the captcha is incorrect a response is sent back to client to indicate the captcha has to be re-entered.

When the captcha is incorrect... I can't figure out how to respond to the client without forcing a page refresh. I want the page the user was on to remain with all the form data inplace so all that has to be re-entered is the captcha and not all other form elements.

I'm sure this has been asked before, but I can't find the response:-(
Thanks in advance.
Feb 7 '08 #1
5 3729
BigDaddyLH
1,216 Expert 1GB
Once I started using a web application framework (JSF, although I dabbled in Struts) I kissed the ground like the old pope. Much of the tedious code you write is handled by the framework. In this case, the captcha would raise an error and the page would be automatically sent back to the user with the form filled out as before and error messages next to the field(s) that failed validation.

Just my opinion, so I'll throw it out there -- who programs web apps and does or doesn't use a framework? Why?
Feb 7 '08 #2
Cli
9
Why I'm not using one... There was just too much to learn when I started this project.. Had only seen Spring in action and it scared me ;-)

Can I do what I'm trying to do with out a framework?

Anyone suggest a good framework, My app is heavily dependant on AJAX and DB access.
Feb 11 '08 #3
BigDaddyLH
1,216 Expert 1GB
Why I'm not using one... There was just too much to learn when I started this project.. Had only seen Spring in action and it scared me ;-)

Can I do what I'm trying to do with out a framework?

Anyone suggest a good framework, My app is heavily dependant on AJAX and DB access.
AJAX -- now that's scary. What fraemwork/toolkit are you using for it?

I've used JSF, which is part of the J2EE. It does take time and has it's pluses and minuses. Struts has been around for a long time and has several offshoots, and Spring has its own web app framework, too. One of the joys/pains of Java is that there are so many choices.

By the way, I've heard developers say the following many times: "I don't have time to learn a framework". They the realize they have to code up their own framework, which takes even longer. Learn to stand on the shoulder of those who have gone before you.

In any case, keep your presentation separate from your database bck end -- there should be no mention of database access in your servlets/JSP.
Feb 11 '08 #4
r035198x
13,262 8TB
If you want to do it using AJAX then you should probably be asking in the Javascript/AJAX forum.
With AJAX the page would not (appear to) be submitted at all so all the fields would have their original values.
Feb 12 '08 #5
My re-worked version of the jcaptcha.jsp file should do what you want.

I have a working example, that shows how to preserve all the input
fields values on a refresh, or call and return to results page.

http://jcaptcha.webregistrationservices.com/

The jcaptcha.jsp and all example source available for download there.
Mar 28 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Jangley | last post by:
Hi Tomcat seems to be completely ignoring any resource that I specify in an <error-page> directive in the web.xml. The same webapp works under 4.0. Is there a bug in 4.1 that I'm not aware of?...
2
by: Steve | last post by:
Does anyone know what is wrong with this code or why I might be experiencing this behavior? I have a Java application that submits HTTP POST requests to a servlet (with content in the body of...
1
by: Vasil Slavov | last post by:
I apologize for the long email. I hope somebody will have time to read it and give some suggestions. I am working on a school project written in Python (using mod_python) and I need to upload a...
0
by: Anto | last post by:
Hi, We have a asp and the source is, <% Response.Expires = 0 appnum = Request.QueryString("appnum") pdfpath = Application("pdfpath") set objXML = server.createobject("TASJobReport1.JobReport")...
1
by: Mad Scientist Jr | last post by:
How do you get a ASP.NET page to return nothing, so the page posting form data to it doesn't reload? I have tried all combinations of the following: Response.SuppressContent = True...
3
by: Richard | last post by:
Hey there, I have a textbox and a listbox. When a user types a number in the textbox, I want to get all the records from a MS Access DB but without reloading the page. I now have something...
1
by: sang | last post by:
Hi I prepared a program for Email Integration. That is email send to others through servlet's. I gave the code but it has some error in my code. Please check the code and give the feedback. ...
0
by: ErikaW | last post by:
Hi all, I've tried to google this but could not find a clear solution. I have a Web application developed in JDevloper using mostly html and Javascript. I have a pre-defined PDF form which I merge...
16
by: naveenkongati | last post by:
hi, Please have a look at the following jsp page code , when this page gets loaded "null" is being printed. Please suggest me where i am doing wrong. Servlet code is also added for more details. ...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.