Win a copy of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques this week in the Server-Side JavaScript and NodeJS forum!
  • 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
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Identify Form field changes in Struts

 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would like to identify which form fields(properties) has been changed during form submit in struts.

Here is the situation:

I have a Struts form which has set of fields and this form is used to edit. On submit I would like to know if a particular field say "server IP" field in the form has been changed or not. Is there any predefined of identifying that in struts.

 
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No, not anything particular I know. But why you need it, can't you just UPDATE all the fields without bothering if the value is really changed or not.

OR If you've some requirement like the user is not allowed to change any field, then make it DISABLE, then.
 
Shriram Gopalakrishnan
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, I am doing so for other fields but this field change would require an additional step which i want to trigger/execute only when this field changes to avoid the overheads.

I am sure struts would have some option to identify whether a particular form field has changed or not during form submit.

I know its not straight forward, but any help would be appricated.
 
Sagar Rohankar
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Shriram Gopalakrishnan wrote:Well, I am doing so for other fields but this field change would require an additional step which i want to trigger/execute only when this field changes to avoid the overheads.


OK, if you have some set of fields which you want to look for any value change, then I suggests using "hidden" fields for those desired properties, so that when form gets submitted, in server side, you can compare submitted TEXT FORM field with the original unchanged HIDDEN fields.

Shriram Gopalakrishnan wrote:I am sure struts would have some option to identify whether a particular form field has changed or not during form submit.


Unfortunately, I'm not sure about such FORM utility for Struts.
And this *may* because, on each SUBMIT action, struts creates new instance of Action Form which has NO knowledge of previous Action Form rendered on EDIT page.

HTH
 
them good ole boys were drinking whiskey and rye singin' this'll be the day that I die. Drink tiny ad.
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic