日期:2014-05-17 浏览次数:20756 次
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@taglib prefix="s" uri="/struts-tags"%> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Login</title> </head> <body> <s:form action="authority"> <s:textfield name="username" key="user" /> <s:textfield name="password" key="pass" /> <s:submit key="login" /> </s:form> </body> </html>
public class AuthorityAction extends ActionSupport { private static final long serialVersionUID = 6397739796446922974L; public static Logger logger = LoggerFactory .getLogger(AuthorityAction.class); String username = ""; String password = ""; String tip; public String getUsername() { logger.debug("getUsername"); return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getTip() { return tip; } public void setTip(String tip) { this.tip = tip; } public String execute() throws Exception { logger.debug("开始执行"); logger.debug("username is " + username); //username得不到 return SUCCESS; } }
public String execute() throws Exception { system.out.print(getUsername()); return SUCCESS; }