Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to understand form fields were changed to new values  RSS feed

 
Diggy Lans
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 10879
158
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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().
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!