ELLO
我有2个Managed bean,一个是View作用域,另一个是作用域.View作用域bean定义为
@ManagedBean
@ViewScoped
public class InvoiceController implements Serializable {
private static final long serialVersionUID = 1L;
@ManagedProperty(value="#{invoiceService}")
private InvoiceService invoiceService;
Run Code Online (Sandbox Code Playgroud)
会话作用域为bean
@ManagedBean
@SessionScoped
public class InvoiceService implements Serializable{
Run Code Online (Sandbox Code Playgroud)
我正在使用会话范围的bean来保存一个标志,用于决定是否应该呈现一个面板,当我通过调试运行时,我发现每次我在sesison bean上调用该方法时,它都是一个新的bean实例因此不会在请求之间保留我的标志值.
我究竟做错了什么?
jsf-2 ×1