Simple Web sites typically use static layout with a predefined number of screen components (menu, navigation bar, main/content part of the page, sometimes a header and a footer, banners, etc.). Such layout is well supported by Server Side Includes, Spring's master layout and a few other easy techniques.
When there are many screen components and their visibility, layout and state may depend on the request, user's role, various settings, the type of the results to display or their number, it becomes easier to allow dynamic layout, which represents a data structure of displayable screen components (ModelAndView instances in the case of Spring), which recursively paints itself on the Web page. This approach uses the traditional GoF design pattern called "Composite". See also .
Since dynamic layout introduces potentially unlimited number of components, some efficiency issues need to be resolved. The new issues are scopes, lifecycle management and events for the dynamic screen components. Let us illustrate these issues:
Spring offers a more general scoping mechanism for its Web components - see . (Spring 2.0 also allows custom scopes; e.g. components being re-created in response to certain events. For example, it could make sense to create a scope, which is somewhere in-between request and session - when user browses through the same result set, the custom sort order for the results is preserved, but, when there is another interaction within the same user session, then some display parameters get their default values again - this could be called "interaction scope" whatever is meant by interaction.) Using scopes properly can optimize the performance, since it allows to reuse certain heavyweight objects and to avoid unnecessary initializations on components, which we are sure to need again soon.
In this lab exercise you will implement a dynamic layout of some filters, which allow browsing test items by some (fixed) number of search facets (owner, creation date, tag, their precise topic). There is also a two-screen browsing of itemsets and their items and past assignments and their items, which allow composing new assignments/quizzes.
Queries and Facetted Browse.