Framework Page
As shown in the following diagram, the abstraction of a controller framework page consists of two physical Java™ Server Pages (JSP) pages. These are called the event JSP and the UI JSP.
When a request is made for a JSP page, the event JSP page loads. In the event JSP, the UI modules, the data providers, and the controller are declared. The modules are registered to the controller. This process creates the "model" component of the MVC methodology and executes it. The event JSP then redirects control to the UI JSP page.
The UI JSP represents the display of the page. It contains the HTML for the page, and calls to render the UI modules. This represents the "view" component of the MVC methodology. The UI JSP does not directly call the render method of the UI module(s). It instead calls the WcmUi helper class, which is used to render UI modules and page headers (via WcmHeaderModule, as described in HTML Headers -- Using Default Implementation).
Event JSP pages are stored relative to the application root. UI JSP pages are stored relative to the uiRoot context parameter in <app_root>/WEB-INF/web.xml. The default value is "UI-INF", and the string "jsp/ui" is implicitly added by WcmController, yielding "UI-INF/jsp/ui". The following example shows the location of an event JSP and its corresponding UI JSP.
- Event JSP: <app_root>/ui/operations/WcmUnfileObject.jsp
- UI JSP: <app_root>/UI-INF/jsp/ui/operations/WcmUnfileObject.jsp
This example assumes a one-to-one mapping of separate event and UI JSP pages. This is not a hard requirement. For example, the framework allows for many event JSPs to map to a single UI JSP -- assuming that UI modules are given the same names on each event JSP. In addition, you can consolidate the event and UI parts into a single JSP page.
Event JSP
An event JSP page consists of the sections listed below. For details on a particular JSP section, click the applicable link.
Declare Page Directive<%@ page errorPage="/WcmError.jsp" autoFlush="false" %>
- Declares your framework error page to use if exceptions are caught by the event JSP page.
- Little or no output is produced by the event JSP page, so autoFlush = "false".
<jsp:useBean id="signInModule" class="com.filenet.wcm.apps.server.ui.WcmSignInModule" scope="request"/> <jsp:setProperty name="signInModule" property="name" value="signInModule"/> <jsp:useBean/> <jsp:useBean id="controller" class="com.filenet.wcm.apps.server.controller.WcmWorkplaceController" scope="request"/> <jsp:useBean/>
- All beans are request scoped.
-
All module beans (UI and data providers) must be uniquely named using
the
jsp:setPropertytag as shown in the signInModule bean declaration above. - The above code is from the FileNet P8 Workplace application sign-in page; there are no data provider beans for this page.
<%
com.filenet.wcm.toolkit.util.WcmString heading =
new WcmString("server.WcmSignIn_jsp.heading", "Sign In");
controller.configurePage(application, request);
controller.getHeaderModule().setTitle(heading.toString);
controller.registerModule(signInModule);
controller.handleEvent(application, request, response, true);
%>
- controller.configurePage initializes the controller, which includes construction and registration of the header module.
- Set the title string in the header module.
- All UI and data provider beans must be registered with the controller.
- If module bean names are not unique, an exception will be thrown.
- controller.handleEvent executes the model. In this example, the controller.handleEvent signature is called with the fourth parameter, a boolean, set to true. This tells the controller to automatically redirect to the UI JSP of the same name as the event JSP.
UI JSP Page
A UI JSP page consists of the sections listed below. For details on a particular JSP section, click the applicable link.
Declare Page Directive<%@ page errorPage="/WcmError.jsp" autoFlush="true" contentType="text/html; charset=UTF-8" import="com.filenet.wcm.toolkit.server.util.*" %>
- In FileNet P8 Workplace, the page directive is centralized in
WEB-INF/jsp/WcmHeader.jsp as an include:
<@ include file="/WEB-INF/jsp/WcmHeader.jsp" %>
- Declares your framework error page to use if exceptions are caught by the UI JSP page.
- Output is produced by the UI JSP page, so autoFlush = "true".
- Specify contentType/charset.
- Import any packages necessary for rendering.
<html>
<head>
<% WcmUI.renderHeaders(request, out);
%>
</head>
...
- WcmUi.renderHeaders retrieves the header module, which renders the HTML headers onto the page. The headers include title, link, and script tags. The header module implements WcmHeaderModuleInterface.
- By convention, a <base href="..."> element is always included,
for example:
<base href="http://wa-mudblood:7001/Workplace/">
Page names are always base-relative. In your code, you fully qualify a page name by combining the application base path with the base-relative page name, for example:
<base href="http://wa-mudblood:7001/Workplace/properties/WcmMoreObject.jsp?eventTarget=...">
...
<body class="wcmBody" bgcolor="white">
<br>
<br>
<br>
<% WcmUi.render(request, "signInModule", out);%>
</body>
</html>
- Body tag contains display details.
- HTML positions the UI module.
- WcmUi.render looks up the named UI module scoped in the request object
and renders the UI modules. The second parameter corresponds to the
declared bean ID, not the name used to register it with the
controller.
NOTE The above code shows a simple rendering example, where only one UI module is involved. For more complex layouts involving multiple UI modules, page layout modules are used.
Feedback