Author | Message |
---|---|
venny
Posts: 61
|
Posted 17:14 Oct 22, 2015 |
Hi, I'm working on the Homework and I'm having trouble with the data validation, if we find an error, we have to go back to the registration page with the form filled out with the previous info. Do we have to use cookies? sessions? Can I just pass parameters around? |
GeorgeAria
Posts: 14
|
Posted 17:57 Oct 22, 2015 |
So I assume what you're asking is how to make your form elements sticky(at least, the ones that were validated). There are different ways to make a form element sticky. I believe you can use cookies to do this, since they can store data in the client's computer and you could access that data when you needed it(not 100% though since I'm not using them in my code). Just make sure to only send back data that is DEFINETELTY validated, like if they I inputted a real email address. There shouldn't be any incorrect data in the registration form if you send the user back there. Hope this helps, and good luck on the midterm!! :)
|
acervantes
Posts: 28
|
Posted 20:57 Oct 22, 2015 |
This assignment does not require the use of cookies or sessions. Think about the problem this way. When the form is submitted via a POST method, we process the form data in the doPost method. If there are any errors, we are to simply re-display the form. If your doGet method was created to display the form, then you can simply forward the request and response objects to the doGet from within the doPost method. Example: So, in short, you do not need to use cookies or sessions. |