This example shows how to use MINERVA as a servlet with Tomcat/Jakarta/Apache....
Move to
=> <=
Darueber Spitze
See also
HelloWorld
Use Parameters
Directives
Debugger
Arithmetic
Constraints
File From Server
AppletLoadsFile
GetURL
Client-Server with Sockets
Date
ExecProcess
ExecProcess_2
GUI
GuiEvents
Gui Image
Interactive
JavaToMinerva_1
JavaToMinerva_2
JavaToMinerva_3
JavaToMinerva_4
JavaToMinerva_5
JavaToMinerva_6
Java Applet Uses Minerva
JavaArrays
MinervaToJava
MinervaToJavaScript
MinervaToJava_1
MinervaToJava_2
MinervaToJava_3
MinervaToJava_4
Reflection
Servlet
JDBC
Internationalization
StartupArchive
IF Computer > MINERVA > Example Programs > MINERVA Features > Servlet

Servlet

This example shows how to use MINERVA as a servlet with Tomcat/Jakarta/Apache.

The servlet minserve takes some user information from an HTML FORM element, then echos the user information in HTML, XML or plain text.

The example shows how the MINERVA servlet predicates are called by FORM methods GET or POST, how to get the input parameters from the servlet request, build a Prolog term, convert it to the desired format and write it back to the servlet response to the HTTP client. Every step is logged to the server log.

The example has been prepared using the Jakarta Tomcat 3.2 and 4.0 servlet web servers by the Apache Software foundation, http://jakarta.apache.org/tomcat/index.html and Sun Java JDK1.4.

The example consists of the following files:

minserve.html - HTML file that contains the HTML FORM element.

minserve.min - MINERVA servlet program

web.xml - Tomcat control file that maps the servlet to its URL and tells Tomcat which MINERVA file it should load

A listing of the predicates provided by MINERVA is

servlet.mpk - servlet built-in predicates

These predicates correspond to their counterparts of the Java Servlet interface.

Running the Example

Follow these steps to install and run the example. The commands are given in UNIX/Linux conventions, adapt for other operating systems as needed.

  1. Install MINERVA and TOMCAT
    In the following we assume that MINERVA is installed at $MINERVA_HOME and Tomcat is installed at $CATALINA_HOME.

  2. Make a servlet directory
    mkdir $CATALINA_HOME/webapps/minserve
    mkdir $CATALINA_HOME/webapps/minserve/WEB-INF
    mkdir $CATALINA_HOME/webapps/minserve/WEB-INF/minerva
    mkdir $CATALINA_HOME/webapps/minserve/WEB-INF/classes
    

  3. Copy HTML file to servlet directory
    cp minserve.html $CATALINA_HOME/webapps/minserve
    

  4. Copy MINERVA system files to the servlet directory
    cp -r $MINERVA_HOME/com $CATALINA_HOME/webapps/minserve/WEB-INF/classes
    cp -r $MINERVA_HOME/servlet/WEB-INF/classes/com $CATALINA_HOME/webapps/minserve/WEB-INF/classes
    cp  $MINERVA_HOME/minerva.mca $CATALINA_HOME/webapps/minserve/WEB-INF/minerva
    cp  $MINERVA_HOME/servlet/WEB-INF/minerva/servlet.mpk $CATALINA_HOME/webapps/minserve/WEB-INF/minerva
    

  5. Copy servlet program to the servlet directory
    cp minserve.min $CATALINA_HOME/webapps/minserve/WEB-INF/minerva
    

  6. Compile the servlet program
    minervac minserve.min
    

  7. Restart the Tomcat server
    $CATALINA_HOME/bin/shutdown.sh
    $CATALINA_HOME/bin/startup.sh
    

  8. Invoke the servlet
    In a default installation of Tomcat, the URL will be http://localhost:8080/minserve/minserve.html

read on...
MINERVA
ifcomputer logo
f
Expert Services on the Web
Sprache
English
Japanese
Server
USA
Japan
Site Access
Local Index
Local Contents
Site Contents
Site Index
Printer Friendly
For imode
For PDA
Search
document: http://www.ifcomputer.co.jp/MINERVA/ExamplePrograms/MinervaFeatures/Servlet/home_de.html
published 2008/10/13 update 2002/3/19 (c) 1996-2006 IF Computer Japan
IF Computer 5-28-2 Sendagi, Bunkyo-ku Tel +81-3-5814-3352 start (AT) ifcomputer.com
Customer Support Tokyo 113-0022 Japan   http://www.ifcomputer.com
scroll to top managed with ubiCMS