The JSP documentation mentions that the setProperty tag does not set blank or null values. I use JSP to display a form with values populated by properties in the session. The problem is once a value is set, if the user clears a text field, the setProperty tag ignores the blank value and never updates the bean with the blank value.
I tried replacing blanks with a space and adding a .trim() to the setter, but unfortunately the setProperty tag will take expressions for values, but not for the property name, so I can't do it dynamically.
The only way I've been able to get around it (without hardcoding) is to bypass the getters and setters and use a Hashtable in the session that gets updated through enumerating the request paramaters. This is quite a sloppy hack, and I'm hoping one of you fine gurus will know how I can go back to using getters and setters, and still being able to update properties w/ blank values.
Thanks in advance...
sterling
I tried replacing blanks with a space and adding a .trim() to the setter, but unfortunately the setProperty tag will take expressions for values, but not for the property name, so I can't do it dynamically.
The only way I've been able to get around it (without hardcoding) is to bypass the getters and setters and use a Hashtable in the session that gets updated through enumerating the request paramaters. This is quite a sloppy hack, and I'm hoping one of you fine gurus will know how I can go back to using getters and setters, and still being able to update properties w/ blank values.
Thanks in advance...
sterling