我对登陆界面定义了一个拦截器,然后在action方法里添加了System.out.println(user.getUsername());就没办法获得action运行时间,但是不添加输出语句就可以实现拦截器获得action运行时间
public class LoginAction extends ActionSupport {
private User user;
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public String login(){
System.out.println(user.getUsername());
return SUCCESS;
}
@Override
public void validate() {
if(user.getUsername()==null
||"".equals(user.getUsername())){
this.addFieldError("username", "用户名不能为空");
}
}
}