Skip to main content

Posts

Showing posts from August, 2009

How to know when FORM (bean) values changed by user or not

Many times, developer want to know whether user has changed the HTML FORM value or values so that at server side action they can take the necessary action if some values has been changed or not changed at all. For example, once someone has requirement regarding whether user changed the IP address fields in the UPDATE HTML FORM, because if that value has been changed by the user, then he need to make several heavy network calls, which he wants to avoid if user doesn't change that single value. Also, recently someone wants to know if the FORM has changed by single value or submitted as it without any change. For this above scenario, there are two (best) possible solutions: 1. If you want to observe the value change for particular bean property, then use dummy variable in bean and if you do not wish to create one, then pass the previous bean value in query string. How to make it: public class MyForm { private String name; private Integer number; // I like to know