这是我的登录页面的支持 bean。为什么调用logIn()
方法后会保留值?我的意思是在我提交表单并返回登录页面后,我之前输入的用户名已经存在。我认为通过使用@RequestScoped
注释不会保留值。
@Controller
@ManagedBean
@RequestScoped
public class LogInBean implements Serializable {
private static final long serialVersionUID = 2092611147930386873L;
@Autowired
private UserService userService;
private String username;
private String password;
private boolean rememberMe;
public String logIn() {
return "index?faces-redirect=true";
}
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;
}
public boolean isRememberMe() {
return rememberMe;
}
public void setRememberMe(boolean rememberMe) {
this.rememberMe = rememberMe;
}
}