Using a custom help location
You can use any help system hosted by a web server to provide online help for a Java Component system. To make an external help system available to the Java Component application, the wwhelp.html file must redirect help requests to that external system. Any specific help target can link to any specific page.
To redirect help requests from Java Component to an alternate URL, edit or replace the wwhelp.html file in <context root>\help. You can further specify different targets using the context and topic parameters in the URLs emitted by Java Component in help requests.
Customizing the help location with wwhelp.htm
Use the following procedure to create a wwhelp.htm file that redirects Java Component context-sensitive help requests to another URL.
1  
2  
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<script type="text/javascript" language="JavaScript1.2">
<!--
...
// -->
</script>
</head>
<body>
</body>
</html>
3  
// get parameters from the URL
method GetParameter( name )
{
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
   return "";
  else
   return results[1];
}
4  
*
*
*
method LaunchHelp()
{
// Get URL parameters
  var context = GetParameter( 'context' );
  var topic = GetParameter( 'topic' );
 
  var baseURL = "http://myhelpserver/viewer/wwhelp.htm";
 
  // Begin flow control using context
  switch (context)
  {
  // map the "BIRTIV" context to an outside URL
   case "BIRTIV" :
   self.location = baseURL + "?single=true&context=" + context + "&topic=" + topic ;
   break;
 
  // map the "UserConsole" context to an outside URL
    case "userconsole" :
baseURL = "http://myhelpserver/ajc11/wwhelp.htm";
   self.location = baseURL + "?single=true&context=" + context + "&topic=" + topic ;
   break;
 
  //the default behavior
   default :
   self.location = baseURL ;
  }
}
The LaunchHelp() method gets the context and topic information from the URL with two calls to GetParameter. The baseURL is set to the myhelpserver application’s online help. The flow control switch statements activate specific URLs depending upon the context. Because the myhelpserver application uses the same context and topic variables as standard Java Component help, they are used directly in constructing the URL when activating the self.location methods.
5  
<body onLoad="LaunchHelp();">
The onLoad parameter activates LaunchHelp() when the page loads.
6  
7  
Test your results by opening Java Component and selecting a help link. The resulting page is from the custom application. For example, the help link on the login page pictured in Figure 10-3 would link to http://myhelpserver/ajc11/help/wwhelp.htm?single=true&context=UserConsole&topic=Document_list.

Additional Links:

Copyright Actuate Corporation 2012