On 1/27/06, Frank W. Zammetti <[EMAIL PROTECTED]> wrote: > > On 1/26/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > When struts takes the data from the request and populates your form, > > does it automatically trim whitespace? I think this might be answered > > from the particulars of HTML rather than struts. Perhaps the question > > is really whether html trims whitespace before building the request. If > > id doesn't, does struts? > > Nope, neither Struts nor your browser (HTML) trims whitespace on the data > it submits. It really wouldn't be correct if either did because it would > then not be an accurate representation of what was entered by the user (or > transmitted by the client if its another machine). I mean, if someone > enters " Hello " instead of "Hello", who's to say the first should be > transformed to the second? You may have a use case that says those are > two distinct values that you have to be able to differentiate. It might > be nice if you could tell Struts (or the browser) to automatically trim > all parameters, but as it is today, you cannot, you will have to write the > code to do this, either on the client or the server.
You could probably define and register a Converter that does the trimming for you. Or you coud use a Filter. These apply if you want to handle it on hte server side... Tamas