猿问

表单验证错误信息未显示

//验证代码

@Override
    public void validate() {
        //用户名不能为空
        if("".equals(u.getUsername())){
            this.addFieldError("usernameError", "用户名不能为空!");
        }
        if(u.getPassword().length()<6){
            this.addFieldError("password", "密码长度不能少于6位!");
        }
    }

//登录方法

@SkipValidation
    public String login(){
        UsersDao udao=new UsersDaoImpl();
        if(udao.usersLogin(u)){
            //在session中保存
            session.setAttribute("loginUserName", u.getUsername());
            return "login_success";
        }else
            return "login_failure";
    }

//struts配置

<package name="users" namespace="/users" extends="default">
        <action name="*_*" class="action.{1}Action" method="{2}">
            <result name="input">/users/Users_login.jsp</result>
            <result name="login_success">/users/Users_login_success.jsp</result>
            <result name="login_failure">/users/Users_login.jsp</result>
            <result name="logout_success">/users/Users_login.jsp</result>
        </action>
    </package>

有哪里有问题吗

yupei
浏览 923回答 1
1回答

慕设计2395807

BATWZSPRKKXTAJSKKDGWQMNXCZYFSEXHALBIPVSOORAHSBZPLBYLRIYXXDDGSWQFZTQZJZFYEAANTSKADLBXXAHNIRHXLOAAADZJPIYUHTMCGUKJJJSYQDWHGEDJPSNTGVMYGMFPYHHNDXKETDBRNDJCMNWMFVLHURXUEUEDAGDPVIYOECLBLBXKDGXWWSBKHDQJTDHUWTJIFLUILUTPILROKQUNQDZMLRXDWQWFBGMYYUANGDMBHXNGGSPPSTGYFVHMPLTJDKGDZMVBHRXDSFEOKQDSCZZVOURENTCHEPYWCSLXKKTJQGGMPDTQPCJDWPLIRUHNXWSLUHNKDCWBRSSMCFOEBHZFBUTZMMKNJWMJURXJWFSOOPWUAWTZPSOOHKTTDMCIBBKBNZSZYORRKKADZSZFLXMISLZSLRRNKNJKPHQWMVLOYENUHLAQAPFIQNVDLUKHQMIQHQKZIRMOEUJZIGDFTPYUEMJFJFIRGQTVKOEMOKAWMHXUCSZOETDSOXMCZEHDZVRHXFPFVXGJSHQFPSGRTILORHJZYIAWYBXAJRMJMIXMPRHDSBXUPKGPYORNWAQILHCYBKTPZJGWLIDAIRUEAQLBYNJFVEHESHQTIEGWGCFUQTVEHDEUKHSIKAJLAJFILMIYGDMVYOXTQMVYUQACLVYXZPEHKTPYOROKZVLBQMORHVKZCFNXAWMPKTPSBXFOENXNPYMPLNWZPLNQSPYAPRHWSXSBJTIYAQTOCSAQFVDSIYCHDFIEUWZPSIXZWYBXGCLBKORTQFIDLOLOBKSPRHWSVYOJSUXNOJGCYOMBKGVYUKTXRSLLHEKXAMXRQXGWSIKGDZIHDGHWHQZIYHKGIYBQAPFCLUDGIRUWRUSB

慕粉3835723

你用浏览器F12开发者工具调试一下,打个断点跟踪一下流程
随时随地看视频慕课网APP

相关分类

Java
我要回答