Hi All,
I wonder if anybody can help. We have a web application that makes use of struts and hibernate. We perform our validation in the action class on the server. Our validation at times can be complex and we are required to perform queries to the database.
What we do under normal circumstances is make us of the request to get all the parameters from the session or forms submitted. We then check to see if the object on the form is being edited or is a new object by checking if the id exists.
If it's a new object we simply perform validation and then set all the values on the object. If errors occurred we don't save the object to hibernate and place the object into the session displaying the existing values entered with the error messages. If no errors occur we save the object and put the object in the session with correct values displayed in the session and a message to indicate saved successfully.
If it is an existing object we get the object from hibernate then perform validation and set the values on the object. The problem comes in when there are errors the field values of the object are displayed to the screen with the erroneous values and error messages displayed. If the user now presses on the back button the values in the textboxes/fields have been updated to the database by hibernate which was incorrect as the old values should be displayed as errors occurred during the update.
We understand that when you get an object from hibernate that all changes made to the object will be committed once the transaction is completed. We do however have a work around for the problem which is ugly.
Could any body please share any light on how they possibly deal with similar circumstances in there web environments to deal with validation on existing objects as I am sure many of you have similar environments and possible have come across this before.
Regards,
Ryan Meder
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CTJUG Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/CTJUG-Forum
For the ctjug home page see http://www.ctjug.org.za
-~----------~----~----~----~------~----~------~--~---
