• 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

How to find ActionForm bean changes in struts Action?

 
Greenhorn
Posts: 13
MySQL Database Redhat Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a requirement in struts 1.2 framework where i have 50 to 60 fields in my form in which i have to update only 3Fields(which are changed by the user) so when i submit the form only these 3Fields needs to be updated in the database.

How can i identify the 3 changed/modified fields out of 50 fields in the struts ActionForm.
Your suggestions are very mush appreciated.
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One approach is to keep a copy of the form in the session and compare the submitted value. Another approach (if you don't have to worry about hackers) is to use JavaScript to note which fields change.
 
velMurugan vasu
Greenhorn
Posts: 13
MySQL Database Redhat Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jean Thank you for your reply,Yes we can use javascript but for 50 to 60 fields we have to write huge script but in java we have PROPERTY CHANGE LISTENER that will fire when the user changes the value of the bean but in lot of forum they said this listener is good only for SWING for MVC is not a good idea to use,Also in JSF we have VALUECHANGE LISTENER could you tell me we have this feature in JSP.Are you have any other better solution apart from script and session.
 
Jeanne Boyarsky
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's Jeanne, not Jean. Anyway, it doesn't have to be a lot of JavaScript. With this jQuery example, you can trigger an event on any field changing. Then you would keep track of the name in a hidden field and submit that field to the server. extJS has a similar example

JSP is a server side language to generate HTML (or other formats). Since it runs on the server, it isn't going to be able to tell you something changed.
 
Did Steve tell you that? Fuh - Steve. Just look at this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic