@UrlBinding("/login") public class LoginActionBean implements ActionBean { private ActionBeanContext context; @Validate(required=true) private String username; @Validate(required=true) private String password; public ActionBeanContext getContext() { return context; } public void setContext(ActionBeanContext context) { this.context = context; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } @DefaultHandler public Resolution login() { if (username.equals("admin") && password.equals("admin")) { return new RedirectResolution("/dashboard.jsp"); } else { return new ForwardResolution("/login.jsp"); } } } properties stripes.localizationBundle=MyResourceBundle html <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> <html> <head> </head> <body> <form action="${actionBean.context.request.contextPath}/login.action" method="post"> <input type="text" name="username" /><br/><br/> <input type="password" name="password" /><br/><br/> </form> <br/> <span style="color:red">${errors}</span> </body> </html>


上一篇:
下一篇:
切换中文