I am going to try that out in our new application Frank. The "trim" issue was with our older app, which is the big sustaining force (cash cow) for our company, and I wasn't able to push through the new jar and web.xml changes there, as people are nervous whenever I suggest anything major there.

I do like the JWP concept, and will try it out in our new app and let you know of any shortcommings I find. Thanks for your help and your work in making it available.

Dilip


From: "Frank W. Zammetti" <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
To: Struts Users Mailing List <user@struts.apache.org>
Subject: Re: Trim all fields before validation
Date: Thu, 01 Sep 2005 14:57:36 -0400

The ParameterMungerFilter in JWP didn't do the trick for you? I'd love to know what shortcomings you found so that I can work to improve it :)

Frank

Dilip Ladhani wrote:
I am not a fan of javascript, I know, I can use this, but I have always had browser compatibility issues with javascript. I still use javascript, when absolutely necessary, but I prefer to avoid it.

As far as "required" goes, that probably won't work because I could have a string like " test " which would pass the "required test, wouldn't it? unless I misunderstood what you are suggesting.

I did try a generic loop as per Joe's suggestion and that worked pretty well. Here is a what I did.

java.util.Map map = thisForm.getMap();
java.util.Iterator it = map.keySet().iterator();
while(it.hasNext()){
 String key = (String) it.next();
 Object obj = map.get(key);
 if (obj instanceof String){
   obj = ((String) obj).trim();
 }
 else if(obj instanceof String[]){
    String[] temp = (String[]) obj;
    for(int i=0;i<temp.length; i++){
      temp[i] = temp[i].trim();
    }
   obj = temp;
 }
map.put(key, obj);
}


From: Kishore Senji <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" <user@struts.apache.org>
To: Struts Users Mailing List <user@struts.apache.org>
Subject: Re: Trim all fields before validation
Date: Thu, 1 Sep 2005 09:40:42 -0700

Wouldn't this be easier, without mucking with the form, to let this be
handled by the validator itself. For any field validation you would just
have to have the "requires" validation before you do any other validation, and that way you would take care of empty strings or as Joe said you could
do this in javascript as well pretty easily.




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to