Getting started with MVC(6)
MVC and CDI In before posts, we have already use@Injectto inject bean into the Controller class. In fact, MVC embraced CDI internally. RedirectScoped There is a new CDI compatible scope namedRedirectScopedintroduced in MVC 1.0. A bean annotated with@RedirectScopedannotation can be transfered between two requests, conceptly, it is similar with JSF Flash. TheAlertMessageis an example. Declare a bean with@RedirectScopedannotation. @RedirectScoped @Named("flashMessage") public class AlertMessage implements Serializable {} Inject it into a Controller class. @Inject AlertMessage flashMessage; Access