• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

how to find anything changed on jsp UI, ActionForm

 
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a button on a edit jsp(struts tags), which triggers a call to one of our external services. I want to put a check in my Action before calling service to call it only if values are changed in actionform(UI).

1)edit jsp is populated, displayed to user
2)user makes changes, clicks done.
3)done method in action calls external service

I want to compare already popoulated actionform against modified one. is there a way of doing it?? can I compare two forms in action? how?
 
Ranch Hand
Posts: 425
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Struts don't have idea on what happend at user browser. There are many ways to find out if the content of form has been changed or not
- One of the way to handle this will be to have a hidden field containing the hashcode of the concatenated string of fields in the form and validate the action form by comparing the stored hashcode and new hascode constructed from the new values.
- Or you can write Javascript to set some flag in the form to indicate user has changed atleast one entry.
 
I promise I will be the best, most loyal friend ever! All for this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic