The output of an msp:evaluate tag is inserted into the page that is returned as part of the web request. This section will describe the different types of formatting output. This topic is related to the placement of Mathematica commands into webMathematica pages and more information is found in Appendix: evaluate.
Any result that is computed by an msp:evaluate tag that is not a string will be formatted into a string that will use the necessary HTML escapes. An example is shown below.
This type of formatting is equivalent to MSPFormat with a format type of OutputForm.
Different styles of formatting output can be generated with MSPFormat. The example below uses MSPFormat with a format type of TraditionalForm.
MSPFormat[ Sqrt[ Sin[x]], TraditionalForm]
Output can be generated that is formatted into HTML, MathML, or an image. The latter gives a convenient way to show typeset mathematics.
If the result of evaluate is a string, it is left unmodified and added to the output page. This is often useful for constructing HTML, as shown in the example below.
StringJoin[ "<b>", ToString[ x], "</b>"]
If you have a string and you want it to be formatted with HTML escapes, then you can wrap it in MSPFormat.
Graphics and Image Formatting
There are several convenient functions for formatting graphics objects so that a picture appears in the output. The example below uses MSPShow to display a plot.
You may want to use the msp:evaluate tag to evaluate something without leaving output in the resulting page. This can be done by adding a semicolon ';' after the computation, as shown below.
Adding a semicolon causes the Mathematica symbol Null to be returned, and this is formatted to leave no trace in the output.
Output is suppressed whatever the computation, whether it uses one of the formatting functions, a graphics function, or a function that returns Print or Message output. In the following example, no output will be seen from the message output function because it is followed by a semicolon.
To calculate more than one result in an msp:evaluate tag, the different steps must be separated with a semicolon ';'. The result of the last computation will be formatted and appear in the output page. In the example below, the numerical result of x+y computation will appear.
x = Sin[5.6];
y = Sqrt[x];
If you wish to suppress the result of the last computation, you can use a semicolon ';' as described in the section on Suppressing Output.