WEBMATHEMATICA TUTORIAL

## Mathematica Web Functions

webMathematica contains a large number of Mathematica commands that can be used inside the webMathematica tags that provide useful functionality for creating web material with Mathematica. These are useful in various ways such as processing request parameters that are the input from a web user, formatting results, and using web features such as uploading files and HTTP sessions.

Typically, these commands are used inside of an evaluate tag; more information on these tags is found in the webMathematica tags section. An example, which calculates an integral and uses the function MSPFormat to format the result into TraditionalForm, is shown below.

`<msp:evaluate>  MSPFormat[ Integrate[ expr, {var, 0, Infinity}], TraditionalForm]<msp:evaluate>`

The different functions are shown in the following sections.

### Processing Input

HTTP input variables are a key way to control the operation of a dynamic website. These are typically embedded in your input page with <input> tags. webMathematica provides a number of functions for working with and processing input. This needs to be done carefully to avoid any security problems. The functions are summarized in the following table.

 MSPBlock secure scoping construct for HTTP input MSPToExpression interpret input in a secure way MSPValue return the value of an HTTP input variable MSPValueQ test if an HTTP input variable has a value

### Formatting

webMathematica provides a number of important ways to format output for finished web pages. These include formatting into text, HTML, GIF, XML, MathML, and other formats. These are summarized in the following table.

 MSPFormat format results into text or image formats MSPShow format graphics by creating an image MSPLive3D format 3D graphics to allow interactive viewing MSPGetMessages display any messages MSPGetPrintOutput display any print output HTMLTableForm format into an HTML table HTMLSelect format into an HTML select

### Web Interaction

webMathematica provides a number of key functions for working with web features such as HTTP sessions and file upload. These are summarized in the following table.

 MSPReturn halt processing of the current page and return a different result MSPSessionVariable scope a variable to an HTTP session MSPGetUploadFile get the name of a file uploaded with the HTTP request MSPURLStore store a result on the server that can be retrieved with a URL
New to Mathematica? Find your learning path »
Have a question? Ask support »