• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to find ActionForm bean changes in struts Action?

 
velMurugan vasu
Greenhorn
Posts: 13
Java MySQL Database Redhat
  • Mark post as helpful
  • send pies
  • 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.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34651
365
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • 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
Java MySQL Database Redhat
  • Mark post as helpful
  • send pies
  • 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
Marshal
Posts: 34651
365
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic