I am facing a strange issue of fields in a jsp page retaining old values.
I have a jsp page with a field Type Name and two buttons to Add and Edit.
On click of the buttons the request submitted to the controller which adds appropriate request/session attribute for Add/Edit and forward the request to the same jsp which has 3 fields, TypeName,Description and Associated Id and a button to search the id and one OK and one Cancel button. In the page the fields are populated from request and session attributes using scriptlets by setting the value in the field declaration
The cancel button clears all the field values and submits the request to a controller method which removes session attributes set.
The button to search for the id has a validation code to verify the Name is entered.
Now the problem is once I open the jsp for Add and cancel it and immediately after I opens the page for Edit, the fields retains the old value that is '' , though the session and request parameter that sets the value contains proper value. Only when the value is accessed using document.getElementById('fldId').value it is returning the value from the last load of the page. It is happening for every consecutive load of the page.
The field value is being shown properly in UI, but the validation code that checkes if the field has value is getting failed.
Can any one point out what is the problem?
The page has HTTP tags for no-cache.