<html:errors> struts tutorial or example

后端 未结 3 1650
终归单人心
终归单人心 2021-02-09 05:31

I\'m trying to make a login page in Struts. The idea is to validate if the user exists, etc, and then if there is an error, return to the login page with the errors in red (the

3条回答
  •  旧时难觅i
    2021-02-09 06:09

    In struts action:

    ActionErrors errors = new ActionErrors();
    errors.add("", new ActionMessage("login.msg.err"));
    saveErrors(request, errors);
    

    The "hello.msg.err" is define in MessageBundle.properties

    login.msg.err=Wrong user name or password
    

    In you JSP, error will be shown by h:errors tag:

    
    

    This video shows you step by step & explain you all those things: https://youtu.be/YcCsJtqI72A

提交回复
热议问题