Net.Data Servlets

Net.Data provides servlets and NetObjects Fusion plug-ins with Net.Data functions that can be used in a Java environment. With servlets and plug-ins you can:

This section describes the following servlet topics:

About Net.Data Servlets

Net.Data provides servlets to help you develop and manage macros using the Java environment. Servlets are Java classes that perform a role similar to that of CGI programs or Web server API plug-ins. Servlets are used by a Java servlet-enabled Web server to build HTML pages. Servlets do not have their own graphical user interface, but their classes can be dynamically loaded locally, or from across the network, and can be called using a URL address (remotely) or by a class name (locally). Servlets are available for Windows NT and AIX operating systems.

The Net.Data servlets are a Java-based wrapper that run a Net.Data Version 2 macro or direct request using a native DLL file. These servlets allow you to run an existing macro (MacroServlet) or a single function (FunctionServlet). Net.Data Version 2 is required to use these servlets. Net.Data servlets can run the database or non-database language environments and can run with Live Connection.

The servlets come with an API for use with your applications. The servlet APIs are documented with Net.Data. See the <inst_dir>/servlets/NetDataServlets.jar file for API documentation.

Net.Data provides two servlets:

Macro Servlet (com.ibm.netdata.servlets.MacroServlet)
Executes an existing Net.Data macro.

Using the macro servlet is similar to running a Net.Data macro through the CGI-BIN interface, except you run the macro through a Java servlet. The macro servlet requires that Net.Data Version 2 or higher be installed.

The advantages of using the macro servlet include:

The macro servlet also allows native access to heterogeneous databases, such as DB2 and Oracle, as well as various language environments, such as Perl, REXX, and Java.

Function Servlet (com.ibm.netdata.servlets.FunctionServlet)
Executes the Net.Data function or SQL statement through a servlet interface, such as %FUNCTION DTW_SQL(). See Invoking Net.Data without a Macro (Direct Request) for more information.

The function servlet requires that Net.Data Version 2 be installed.

Running Net.Data Servlets

The Net.Data servlets can be run either from a URL or as an SSI within an HTML file. You can use the NetObjects Fusion plug-ins to incorporate the Net.Data servlets into your NOF site. The following sections discuss how to modify and run the servlets by typing in the syntax for the servlet. See Appendix E, Using NetObjects Fusion NOF Plug-ins with Net.Data Servlets to learn how to modify and run the servlets with NetObjects Fusion.

Running the Macro Servlet

From within an HTML file, enter the servlet parameters using one of the following syntax options:

  1. URL:
    http://myserver/servlet/com.ibm.netdata.servlets.MacroServlet
      ?MACRO=macro_value&BLOCK=block_value&parmnn=valuenn
    

    For example:

    http://myserver/servlet/com.ibm.netdata.servlets.MacroServlet
      ?MACRO=my_macro&BLOCK=my_block&field1=custno
    
  2. SSI:
    <servlet code="com.ibm.netdata.servlets.MacroServlet">
         <param name="MACRO" value="macro_value">
         <param name="BLOCK" value="block_value">
         <param name="parmnn" value="valuenn">
     </servlet>
    

    For example:

    <servlet code="com.ibm.netdata.servlets.MacroServlet">
         <param name="MACRO" value="my_macro.d2w">
         <param name="BLOCK" value="report">
         <param name="field1" value="custno">
     </servlet>
    

Parameters:

macro_value
The fully qualified path to an existing Net.Data macro

block_value
The name of the HTML block in the specified Net.Data macro to execute; the default is report (optional).

parmnn
Any additional parameters that your macro requires, such as
<param name="field1" ...

valuenn
Any additional values that your macro requires, such as
... value="custnum"

HTMLPATH parameter: If you get an error message referring to a missing HTMLPATH parameter, add the HTMLPATH parameter to your servlet invocation command:

OUTBUFLEN parameter: If your macro results are larger than 32 KB, specify the OUTBUFLEN parameter. Failure to specify these parameters when required can result in unpredictable results.

Running the Function Servlet

The function servlet can invoke Net.Data using direct request to execute either a function (such as a REXX function) or an SQL statement. The parameters you specify for the servlet depend on whether you are executing a function or an SQL statement. From within an HTML file, enter the servlet parameters using one of the following syntax options:

  1. For a URL:
  2. SSI:

Parameters:

lang_env_name
The Net.Data language environment (such as DTW_SQL, DTW_REXX) being called to process the function, SQL statement, or stored procedure. This parameter requires that FUNC or SQL be used.

program_name
The name of the program which contains the function to be executed. For example, my_rexx, where my_rexx is the name of a REXX executable. Specify input parameters for the function with the parmnn and valuenn parameters.

database_name
The name of the database associated with the DATABASE parameter. The specified

SQL_stmt_name
An SQL statement or stored procedure name that accesses a database. For example, "select * from employee". Specify input parameters for the SQL statement or stored procedure with the parmnn and valuenn parameters.

parmnn
Any additional parameters that your macro requires, such as <param name="field1" ....

valuenn
Any additional values that your macro requires, such as ... value="custnum".

HTMLPATH parameter: If you get an error message referring to a missing HTMLPATH parameter, add the HTMLPATH parameter to your servlet invocation command:

Where html_path specifies the path to the Web server root HTML directory; for example: htmlpath=e:\html.

OUTBUFLEN parameters: If your macro results are larger than 32 KB, you must specify the OUTBUFLEN parameter. Failure to specify these parameters when required can result in unpredictable results.


[ Top of Page | Previous Page | Next Page | Index ]