MJSP - Mumps JSP tag library


MJSP Taglib

This project is an open-source JSP custom tag library, for interaction with M. It enables rapid development of web applications over M backend.

Project Overview

Mumps (A.K.A. "M") has been, and still is, the basis for many data processing applications. M is well known, at least amongst the "Mumpsters", as a rapid development and high performance environment. Despite that, there is no standard way to develop web applications over M, And this is where MJSP gets busy.

MJSP is a custom JSP tag library, that enables interaction between web interfaces, developed in JSP and JavaScript, to interact with M applications. MJSP tags can be used in a JSP page, to:

  • Set M variables. All the HTTP request parameters are accessible to the M code, as well.
  • Print M expressions.
  • Execute M code.
  • Branch and loop (If and While) over M expressions.
  • Get tabular data from M application and iterate over it.
  • Manage user sessions, that are shared amongst JSP and M, for stateful web applications.
  • Execute M code in the server, from JavaScript, for a more dynamic application. This is done using a client side invisible Applet that communicates with a Servlet over HTTP(S). The M code that is run from JavaScript shares the same session, and all the form fields are automatically passed to the M code.

The library was designed with two main considerations:

  • Performance. Connection to M are pooled with full control over the number of active, idle and maximum connections. Pooling is done using Jakarta commons-pool. The pool is shared between the JSP tags and the JavaScript-invoked M code. Connections to M are made either by M-interpreter child process, or by TELNETing to a machine with a user/password combination, expecting the M-interpreter prompt.
  • Portability. Written in Java, MJSP can run on any J2EE implementation (We use Apache Tomcat). MJSP was designed for maximal M portability, with a tiny and simple M code, that can be easily run on any "standard" M.


The software requirements for MJSP are a servlet container that supports the JavaServer Pages Specification, version 1.1 (We use Apache Tomcat 5.5.27), and M (We use Cache').

You can get the binary distribution, or the source distribution from the project page at Sourceforge. To build MJSP use Apache Ant. Run the command ant in the top level directory.

Now, you can install MJSP:

  1. Import the routines in mumps/mumps.ro to M. MJSP uses "%" routines, so use the %RI command (or whatever import utility you use) to import them to the correct namespace (UCI, directory, ...).
  2. Deploy the examples WAR file (mumps-examples.war, you can deploy it with another context name) into the web applications directory ($CATALINA_HOME/webapps/ in Tomcat). You can put your JSP files under the directory mumps-examples/ and remo the images/ and jsp/ directories.
  3. To install these docs, deploy the docs WAR file: mumps-doc.war.

The configuration file is called mserver.properties, and should be in the application's classpath; Put it in WEB-INF/classes/ directory of the application. Use the template file and edit it. The one thing you should probably change in the M connection method. You have two options:

  1. M child process. Set the property child_proc.command to the command line to run M interpreter that runs the routine ^%ZCAVJSP. The Cache' Linux/UNIX command would be cache ^%ZCAVJSP. Use this method if app server and M are on the same machine. It's faster and simpler.
  2. Over TELNET. In this method M connections are performed over TELNET with a user/password@machine combination. You should arrange that once the user is logged in ^%ZCAVJSP will be automatically run:
    • In Linux/UNIX you should do it in a startup script (e.g. put the line cache ^%ZCAVJSP in the .login file).
    • In Cache' on Windows, create a user with a startup routine ^%ZCAVJSP

To get started with MJSP, I suggest going through all the examples. Note that you can read the source in each examples. You'll find useful tips in the the comments.

For reference, use the taglib API documentation .

TBD: Tips on correct MJSP programming, frequent mistakes and problems, and perhaps a tutorial.

08/28/2005 Version 1.0.1 released  
09/08/2005 Version 1.0.2 released:
  • Runs on Windows Cache'.
  • Supports alpha-numeric session IDs.
11/01/2006 Version 1.1.0 released:
  • <m:serverExec> tag enhancements:
    • Does not require JRE on client. It uses XMLHttpRequest JavaScript function.
    • Can pass only the current form field (handy in big forms).
    • Can set an M variable to a given JavaScript expression.
    • Support other form fields (radio buttons,checkboxes).
    • Suppress client side caching of server requests.
  • Support line breaks in M commands.
  • Filter out NULL characters (0) on stream read from M.
  • <m:getColumn> tag supports not setting M side variable, for performance.
10/11/2007 Version 1.1.1 released:
  • <m:serverExec> tag bug fixes:
    • Encode parameter using encodeURIComponent(), to support '+' signs in field value.
    • Don't pass values of nameless fields.
    • Gracefully handle empty server response.
  • Log the pool state when borrowing a session fails.
11/16/2008 Version 1.2.2 released:
  • Works in Tomcat 5.5
  • Added <m:get> tag.
  • Added M sessions pool status servlet, called /mserverStatus
  • Cewolf integration.
  • Bug fixes:
    • Pass request body to M array %BODY
    • Fixed session leak in the case of unhandled exception within the <m:session> tag body.

Q: I know Intersystem's CSP and M/Gateway m_php. Why does the world need another M web scripting interaction technology?

A: I was expecting that one, so it's gonna be easy:

  • Portability: MJSP was designed to run on different M implementations.The M code is slim and plain. MJSP interacts with M interpreter directly, to avoid usage of M socket and other non-standard features. Other solutions support Cache' only.
  • Performance and scalability: With MJSP you can set the number of active and idle M connection in a connection pool. You can have one J2EE application server interacting with many M servers, or many application servers interacting with one M server.
  • Simplicity: MJSP taglib was designed to keep the web development clean and minimal. Just take a a look at the examples page.
  • Open source: MJSP is open-source. It means that not only you can use it for free, you can see the code, learn from it, and modify it to fit you needs.

Q: What do I need, in order to develop with MJSP?

A: Follow the installation notes, to install it over J2EE appserver and M. To develop, use your favorite web development tool ('vi' would qualify...) . Most of them support JSP. If you tool support custom tag library import, import the MJSP taglib file: mumps/taglibs-mumps.tld.


MJSP is open, under GPL. Post bugs and requests to the forums at the project page at Sourceforge. For support information write to us at Cav Systems.


Cav Systems is an Israeli enterprise software house (ERP, banking, tourism), established in 1979. Throughout the years all the core data processing applications were developed by Cav on M, and deployed on different M implementations. Cav Systems has always strived to use cutting edge, open standards, and in the past 10 years has adopted the Java technology for the complementary software and infrastructure, such as GUI clients, portals and Jumps - an automated migration tool from M to Java and RDBMS.

MJSP was developed by Yishai Pinchover and Uri Schor, two members of Cav's R&D team.

Links of Interest
JSP and Tag Libraries at Sun

SourceForge.net Logo

Copyright © 2008 Cav Systems Ltd.