19 Implementing Context-Sensitive Help in a Web Application

Oracle Help for the Web (OHW-RC) provides a context-sensitive help mechanism that launches help topics that are associated with some context in the Web application user interface. Typically, help topics are written to describe the function of a particular page, table, or input field in a Web application. When a user requests help for a user interface control—for example, by clicking a Help button—the appropriate topic for that context (or control) is displayed.

To provide context-sensitive help for a Web application, the help system must include one or more map files, and the appropriate help code must be added to the application code.

The following sections describe how to implement context-sensitive help using OHW-RC:

19.1 Mapping Topic IDs to Help Topics

OHW-RC context-sensitive help systems rely on one or more map files that map topic IDs to help topic HTML files. In a helpset, the map file is saved in XML file format as map.xml.

The map file is usually created by the help author. As a Web application developer, when associating Web application controls with context-sensitive topics you must use the topic IDs specified in the author's map file. Thus, you will have to coordinate your efforts with the help author.

Here is a sample map file in XML format:

 <?xml version='1.0' ?>
 <map version="1.0">
   <mapID target="topic_1" url="file_1.html" />
   <mapID target="topic_2" url="file_2.html#a1" />
   <mapID target="topic_3" url="file_3.html" wintype="intro" />

The target attribute specifies a unique ID for the associated HTML file within a helpset. The url attribute specifies the location of the file to associate with the ID. The wintype attribute is optional; it specifies the name of a window type that the topic will be displayed in. For more information about the elements used in the map file, see Section 6.2, "Map Files".

19.2 Creating Context-Sensitive Links to the Help System

Applications that rely on OHW-RC for context-sensitive help request the context-sensitive topics via specially formulated URLs to the OHW-RC servlet. Any user interface control with a URL destination (links, images, etc.) can be associated with a context-sensitive topic.

When creating a link to OHW-RC for context-sensitive help, you can either use the URL destination for the front main page, which is a tripane-layout UI with the Contents, Index, and Search navigators on the left side, or you can create a URL destination for displaying a topic in tripane-layout UI using the topic ID. You can also specify a locale and a group in the URL destination.

19.2.1 Linking to the Front Main Page

The URL to the front main page is simply the URL to the OHW-RC servlet:

http://<server>:<port>/<servlet mapping>

where, <server> is the name of your server running the servlet container, <port> is the port used by the servlet container, and <servlet mapping> is the servlet mapping set up in the web.xml file for the OHW-RC servlet (oracle.help.web.rich.OHWServlet).

For example, in the web.xml, it has the following servlet definition and servlet mapping:

<!-- configuration for product1 help front servlet -->

In this example, the URL to the front main page is:


When a user requests help for a user interface control that is linked to the front main page, the OHW-RC tripane-layout main page will be displayed in the user's browser, showing the Contents, Index, and Search navigators on the left side.

19.2.2 Linking to a Topic

To create the URL for linking to a topic, add a topic parameter to the URL of the OHW-RC servlet. The value of the topic parameter is the topic ID of the help topic:

http://<server>:<port>/<servlet mapping>/?topic=<topic-id>

For example, the following URL requests the topic associated with the topic ID topic_1:


When implementing context-sensitive links to OHW-RC, you may also wish to use JavaScript to open the link in a secondary window rather than replace the main application page.

When a user requests help for a user interface control that is linked to a topic ID, OHW-RC displays the tripane-layout UI with the topic file shown in the Topic Navigator (the right side), and Contents Navigator is shown in the left side with the topic highlighted in the TOC tree.

19.2.3 Specifying the Locale and Group

When you link to any OHW-RC page, including topic pages or front pages, you can include a locale and a group in the URL of the OHW-RC servlet with the locale and group query parameter.

The topic syntax is:


and the fornt page syntax is:


If you specify the locale, OHW-RC switches to the localized helpset if it is available, and will keep using the specified locale until it is overridden or removed. If the specified localized helpset is not available, the parameter is ignored.

For example:


For more information about locale and group, see Chapter 9, "Oracle Help for the Web Configuration File".