In the domino development environment, there is no good solution for report-based solutions. Recently, the actual report problem has been solved based on the actual needs of users in the actual project application process. You must be able to view the report directly in IE, save the report yourself, and use Excel to output the report as needed.
Because there are many statistical operations in actual report requirements, jdbcodbc is used to solve the problem of statistical operations. The servlet controls the entire report and runs the JDBC driver. Program Access NSF data using SQL statements, use jxl to read excel, present the report to the user client in the form of a file stream, and open the report using an excel program.
Report Structure
The structure of the entire report is as follows.
Figure 1 report structure
Report Implementation
1. Set up Domino to run Servlet
1. Use the domino servlet container to manage the running of the servlet program during the entire report output process. Therefore, you must first enable the servlet program and configure it.
Open the server configuration document of the Domino server, and find the "Domino web engine" tag, as shown in settings.
Figure 2 configure Servlet
Java Server applet support: Select "Domino server applet manager"
URL path of the server Applet: Enter "/servlet"
Class path: Enter the relevant class path names, separated by semicolons (;).
Use the default value for other parameters.
Note: The URL path is relative to the ../data/Domino Directory.
2. About the servlet Development Environment jsdk
The development environment of standard Domino designer does not support servlet development. Therefore, you must use a third-party ide or command line JDK to develop ServletCode. Here we use the eclipse integrated development environment to develop servlet.
Domino servlet supports JVM and Servlet manager. When the servlet is "enabled", JVM is loaded before the HTTP server is started. If Domino servlet manager is used, it is loaded after the JVM is loaded. If a third-party servlet manager is used, only JVM is loaded.
When you access the servlet from a browser, the URL is http: // myserver/servlet/servletname. For example, enter the http: // myserver/servlet/domstat running report statistics servlet.
When the Web server starts to load the servlet, the servlet will start to work in the memory. However, after the servlet code is changed, the Domino HTTP server must exit and restart to activate the new code.
You must enter the "Tell HTTP restart" command in the domino console to reload the HTTP service.
Common Errors related to servlet configuration files include:
- File directory placement error. It must be in your Domino data directory.
- Incorrect file extension. Many editors such as NotePad use the txt extension.
- Case sensitivity error. The file name is case sensitive like the servlet name.
2. Install the notessql driver
Notessql is an ODBC driver for NSF-type databases and complies with odbc2.0 specifications. After the notessql driver is installed, NSF-type databases can read data using SQL statements. Currently, the latest notessql version is 3.02. Download the corresponding installation file from the IBM website. After the download is complete, install and configure it on the machine running the Domino server.
After the installation is complete, you can select from the data source type to configure the connection to the NSF database When configuring the ODBC data source. This is an example.
Figure 3
3. Configure the ODBC Data Source
Start Control Panel> ODBC data source to create the required system Data source:
Figure 4
Select "system DSN" as the data source type, and click "add" to create an NSF-based Data source:
Figure 5
Data Source Name: name of the input data source
Domino server: enter the name of the Domino server or the IP address of the Domino server.
Database: select the corresponding NSF Database
4. Compile Servlet
1. Select the familiar Java source code development environment. Here I select eclipse3.1.
2. Create a servlet class
Public class domstat extends httpservlet {
}
3. Servlet Source Code:
Source codeDownload
5. Run Servlet
After compilation, copy the output class file to the servlet directory and directly enter http: // SERVERNAME: SERVERPORT/servlet/domstat In the IE address bar. The running effect is as follows:
Figure 6
Running Environment
- Lotus domino6.5 or above
- ODBC driver for notessql3.02 for NSF
- The jxl. jar package reads the Excel
- Office applications