The ViewController is just a concept which binds a specific bean to a web-page. In JSF this means, you have a managed bean configured which directly matches to a view-id.
If you follow this concept you'll gain some very comfortable things. They are:
Notifications:
RESTORE_VIEW
phase.
INVOKE_APPLICATION
phase.
PRE_RENDER
phase.
@ConversationRequire
which allows you to issue a redirect if a
conversations timed-out in the mid of a e.g. wizzard style pageflow.
org.apache.myfaces.orchestra.viewController.jsf.ViewControllerPhaseListener
.
ViewControllerManager
. Now, if you are in need
of a custom name mapping scheme, just create jour own
ViewControllerManager
by inheriting from the
org.apache.myfaces.orchestra.viewController.AbstractViewControllerManager
class. Two methods you have to implement allow you to provide custom implementations for the
>NameMapper
and the Executor
.
org.apache.myfaces.orchestra.viewController.ViewControllerManager
. For example:
<bean name="org.apache.myfaces.orchestra.viewController.ViewControllerManager" class="your.package.YourViewController" scope="singleton"> </bean>
View-Id | Bean name |
---|---|
mainform.jsp | mainform |
userData/password.jsp | userDataPassword |
requestScope.jsp | _requestScope |
123set.jsp | _123set |
ReflectiveViewControllerExecutor
uses reflection to lookup the
following public methods: initView, preRenderView, preProcess. InterfaceViewControllerExecutor
requires you to implement the
org.apache.myfaces.orchestra.viewController.ViewController
interface.
AnnotationsViewControllerExecutor
might be the most powerful one.
It allows you to configure a managed bean as view controller without following any
naming scheme. Not for the bean name nor for the method name.ViewControllerManager
if you
do not want the default ReflectiveViewControllerExecutor
.AnnotationsViewController
you have to use the core15
module. Once you added the jar to your classpath and configured the
required import statement
in your configuration file you are done.
AnnotationsViewController
provides is, that you do
not have to follow any naming scheme. Just annotate your managed-bean with the
@ViewController
annotation.
@ViewController( viewIds={"/annotations/Page1.jsp", "/annotations/Page2.jsp", "/annotations/Page3.jsp"}) public class MultiViewController {Which means the class
MultiViewController
is responsible for the three
configured pages and will receive the notification to the methods annotated with the