webMathematica >

Developing Your Own Pages

This might be a good time to revisit the webMathematica index page found at http://localhost:8080/webMathematica/index.html, which provides a number of links that demonstrate features of webMathematica. When you actually want to write your own material, you may look at the Tips and Tricks described in this chapter. The chapter continues to describe other page development utilities that are part of webMathematica.

Wolfram Workbench

More information can be found in the Workbench documentation, but the following gives a summary of some of the main features.

webMathematica Projects

Syntax Support for JSP Pages

Authoring Pages

Wizards

Server Interaction Tool

Full webMathematica Documentation

Debugging for Mathematica Code

Tips and Tricks

Variables

<input type="text" name="setting" />

<msp:evaluate>
If[ MSPValueQ[ $$setting],
....
]
</msp:evaluate>
You should be aware that input variables are a potential security risk to your server. Therefore, you should always use the special functions, MSPBlock and MSPToExpression, for converting into Mathematica input. In particular, you should never use ToExpression on an input variable. An example of using MSPBlock is shown below.
<input type="text" name="fun" />

<msp:evaluate>
MSPBlock[ {$$fun},
Integrate[ $$fun, x]
]
</msp:evaluate>
<input type="text" name="expr" />

<msp:evaluate>
tmp = Null;
tmp = MSPToExpression[ $$expr] ;
</msp:evaluate>

<p>
<msp:evaluate>
If[ tmp =!= Null,
....
]
</msp:evaluate>
</p>

Coding in Pages

<msp:evaluate>
Integrate[ 1/(1-x^3),x]
</msp:evaluate>
Note that the Mathematica code will evaluate in the typical way for Mathematica and the result of the computation will appear in the web page. You can use MSPFormat to change the way that the result is formatted; more information on formatting in webMathematica is found in Advanced Topics: Evaluation Formatting. An example of MSPFormat is shown below; this formats the integral into TraditionalForm using a GIF image to display the result.
<msp:evaluate>
MSPFormat[ Integrate[ 1/(1-x^3),x], TraditionalForm]
</msp:evaluate>
<msp:evaluate>
x = 109;
</msp:evaluate>
<msp:evaluate>
x = 109;
y = 44.5;
{x+y}
</msp:evaluate>
More information on coding in webMathematica pages is found in Appendix: MSP Taglib, which gives a detailed reference on the webMathematica tags.

Templates

Browse Examples

The webMathematica examples can be reached from the webMathematica home page, which you should be able to reach via http://localhost:8080/webMathematica. (You may have some other URL for accessing your server.) The home page shows examples wrapped up in a template that adds more design around the pages to give them a better visual appearance. This template makes use of HTML frames and so it would be relatively easy to modify your own work to make use of it.

Design Examples

Banners and Buttons

A collection of banners and buttons are available for use in your pages, which you can find with the link http://localhost:8080/webMathematica/BannersImages/. To use one of these images, such as the banner webm-white.gif, you can use an img tag such as the following.
The section on including static files has more information on how to include images.

Minimal Installation

Minimal File Layout