Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I reset a property to a blank value?

Status
Not open for further replies.

skitzer

IS-IT--Management
Apr 3, 2001
1
US
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top