Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
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
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: 4419
    
    5

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
 
Similar Threads
Problem in Listening to Key events in JTable
How to detect data change in JTable
Struts 2 updating record problem
A Design Question.
Urgent! jtable get value when cell is edited