aspose file tools*
The moose likes Struts and the fly likes How to understand form fields were changed to new values Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to understand form fields were changed to new values" Watch "How to understand form fields were changed to new values" New topic
Author

How to understand form fields were changed to new values

Diggy Lans
Greenhorn

Joined: Jul 29, 2003
Posts: 4
Hello!
I display some data from a database to a user. The data lives in an ActionForm. A user may change the data and in this case I want to save it to the DB. But I am looking for a way not to save data if nothing was changed. Is there a way to do it with Struts?
thanks in advance
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 5270
    
  10

Not in Struts per se but you can do it with POJOs (Plain Old Java Objects) and overriding the equals() method. Basically, you put all new values in one instance, then see if it equals() another instance that has the old values.
This JavaWorld article talks about how to override equals().


Junilu - [How to Ask Questions] [How to Answer Questions]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to understand form fields were changed to new values