Custom Views

As the view implementations we've discussed demonstrate, it's easy to implement the View interface, especially if we subclass the com.interface21.web.servlet.view.AbstractView convenience class. A custom view implementation can integrate with almost any view technology. We simply need to provide an implementation class, which might be generic or app-specific, and provide a view definition using the standard JavaBean syntax. The power of the basic approach is shown by the fact that a View implementation could easily be written for each of the following, without any need to change controller or model code in the app concerned:


Using the approach described here, we can define a view for anything that can take model data and generate output. If necessary, we can convert model data into a form other than Java objects.