struts annotation issue

Posted by Gourav on Stack Overflow See other posts from Stack Overflow or by Gourav
Published on 2010-04-30T07:14:26Z Indexed on 2010/04/30 7:17 UTC
Read the original article Hit count: 151

Filed under:
|

My issue is that i have an annotation in Struts2 action class like

private String[] origfilenofrom;

@FieldExpressionValidator(fieldName="origfilenofrom",key="",message="File Length should be 12 for old file format and 15 for new file format",expression="checkorigFileFormat(origfilenofrom)")

now my mehtod is

public boolean checkorigFileFormat(String[] files )
 {   
  for(int counter=0;counter<files.length;counter++)
     {
   int n=files[counter].length();
   if(!(n==12 || n==15))
   {
    return false;
   }
     }
     return true;
 }

So for any string in that string [], which is returning false the value is bei false. No matter 3 strings in that string [] are true if one is false then the annotaion message is displayed for all.

I want the message not to display where the string is true. Help please

© Stack Overflow or respective owner

Related posts about java

Related posts about struts2