我的小应用程序中有 2 个@SessionScoped
bean。即使我重新启动清理服务器,所有表单值都会保留。
@ManagedBean(name = "bill")
@SessionScoped
public class Bill implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
private static final String MANAGED_BEAN_NAME = "bill";
/**
* @return the current instance of Bill
*/
public static Bill getCurrentInstance() {
return (Bill) FacesContext.getCurrentInstance().getExternalContext()
.getSessionMap().get(MANAGED_BEAN_NAME);
}
//other methods
}
@ManagedBean
@SessionScoped
public class TailorTip implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
private Bill bill;
private Participants[] participants;
private Integer participantIndex;
@PostConstruct
public void init() {
bill = Bill.getCurrentInstance();
}
//other methods
}
如何避免保留值?注意:我使用tomcat。