0
votes

When trying to pass the value I receive this error:

javax.servlet.ServletException: javax.servlet.ServletException: Unable to >create managed bean createController. The following problems were found:

Property configMB for managed bean createController does not exist. Check that appropriate getter and/or setter methods exist.

The scope of the object referenced by expression #{configMB}, request, is shorter than the referring managed beans (createController) scope of view at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:138)

Is it possible to pass a value from @ApplicationScoped to @ViewScoped?

1

1 Answers

0
votes

You can inject long-life beans into short-life beans. (Not vice versa)

@ApplicationScoped
public class AppBean {

    private Object someValue;

    //getters
} 

@ViewScoped
public class ViewBean {

    @Inject
    private AppBean appBean;

    public void sendForm() {
       Object value = appBean.getSomeValue();
       // do things...
    }
}