• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

which is the best option to validate if an ActionForm has changed?

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
which is the best option to validate if an ActionForm has changed (the user changed one or more values in it inputs on the jsp) in Struts?

the ActionForm has a lot of instance variables, including lists.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Maybe a hash code, if you don't need to know *what* changed?
 
facundo martin rodriguez
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

David Newton wrote:Maybe a hash code, if you don't need to know *what* changed?



your solution is very promising, but, i can't deal with the collisions of the hascode(), i haven't the 2 ActionForm's instance in the same time to applie the equal() method if i have a collisions with the hascode ( when i tell you collisions i refer to have the same hascode but with diferents values in the intance variables of the ActionForm's intances).
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Pass the original hashcode in the form submission.

If you're hashing correctly the chances of a collision are *extremely* small.
 
facundo martin rodriguez
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

David Newton wrote:Pass the original hashcode in the form submission.

If you're hashing correctly the chances of a collision are *extremely* small.




Hi David,

Thanks for your interest.

I don't have the code of the hasCode redefinition, i didn't do it yet. But my idea is get all the hashcode of the differents intance variables of the ActionForm and multiply that by a fix number (may be 13) and then add all .

May be something like that



that is my ActionForm:



I can't allow any chance of collition, it is a core funcionality of the application.
 
I didn't say it. I'm just telling you what this tiny ad said.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic