Hi Konference
I use Struts2 with validation annotation. Problem is, that validation not
return input. I get fielderror message only but whole method is invoke and
run.

I assume, that I give bad form feld data the action annotated method coud
not be invoke.

-------------------
 @Validations(
          requiredStrings =
                        {  @RequiredStringValidator(fieldName = "login",
message = "Email is reguired.", key = "validation.email.reguired" ),
                           @RequiredStringValidator(fieldName = "password",
message = "Password is reguired.", key = "validation.password.reguired" )
                        },
          stringLengthFields =
                        { @StringLengthFieldValidator(fieldName = "login",
message = "Email is tool long.", key = "", maxLength = "30", shortCircuit =
true), 
                          @StringLengthFieldValidator(fieldName =
"password", message = "Password is tool long.", key = "", maxLength = "20") 
                        }
    )                  
    public String logon() throws Exception{                                     
            
        LOG.info("LoginAction - logon");   
        User user = service.findByEmail(email);     
        String digest = HashUtil.SHA1AsString(password);
        if( user!= null && digest.equals(user.getAccess().getPassword()) ) {    
          
            invalidateSession();
            session.put(SecurityInterceptor.USER_OBJECT,user);       
            LOG.info("Login: " + user);
            return Action.SUCCESS;
        }
        
        addActionError(getText("login.bad.login"));
        return Action.INPUT;

------------------------------
for example:
When I dont give any data to form and send form, get fielderror from
annotation but the whole method continue and I get
addActionError(getText("login.bad.login")); also.

-------------------------------------
<interceptor-ref name="exception"/>    
<interceptor-ref name="sessionContentKeeper"/>                       
<interceptor-ref name="servletConfig"/>              
 <interceptor-ref name="prepare"/>
 <interceptor-ref name="i18n"/>                           
 <interceptor-ref name="staticParams"/>
 <interceptor-ref name="params"/>              
 <interceptor-ref name="validation">
&lt;param name="validateAnnotatedMethodOnly"&lt;true&lt;/param&gt;
&lt;param name="excludeMethods"&lt;input,back,cancel&lt;/param&gt;
</interceptor-ref> 

Thanks for help


-----
Tomas Jurman
Czech Republic
-- 
View this message in context: 
http://www.nabble.com/Validation-Annotation-not-return-INPUT-tp21113449p21113449.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to