在登陆的时候一般要用错误验证功能。效果如图: struts2错误验证 在action层的写法: 在jsp页面上取值: 记得在jsp页面添加<%@ taglib prefix="s" uri="/struts-tags"%>就可以了