Custom controller servlet
A web application that uses the web components must register a controller servlet in the web server.
The controller servlet manages communication between the client side and the server side of the web components. This servlet is an instance of the abstract class IlxWController.
You register a controller servlet using the deployment descriptor of the web application, or using any other way provided by the web server. For more information about web application and deployment descriptors, see the Servlet 2.2 Specifications.
Because IlxWController is an abstract class, you must register either the predefined servlet IlxWDefaultController, or derive your own servlet. Defining your own servlet subclass mainly consists in implementing the method handleError, which is called each time an error occurs during the execution of the service method of the controller.
Following is an example of such a subclass:
public class MyController extends IlxWController {
protected void handleError(HttpServletRequest request,
HttpServletResponse response,
IlxWControllerError error,
String requestPath) {
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
error.getMessage());
}
}
When you have written your servlet, you must register it with the web server and set the value of the context parameter ilog.webui.dhtml.controller_path to the path on which the servlet has been registered. To register the servlet, declare the path in the deployment descriptor of your web application, usually a web.xml file located in the WEB-INF directory of the web application.
The following example shows a typical web.xml file:
<web-app>
. . .
<context-param>
<param-name>ilog.webui.dhtml.controller_path</param-name>
<param-value>/servlet/mypackage.MyController</param-value>
</context-param>
<servlet>
<servlet-name>MyController</servlet-name>
<servlet-class>mypackage.MyController</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>MyController</servlet-name>
<url-pattern>/servlet/mypackage.MyController</url-pattern>
</servlet-mapping>
. . .
</web-app>