3. Basic Examples
This chapter covers a number of initial examples of webMathematica. Many of these can be copied and used as the basis for your own work.
These examples are a form of JavaServer Pages (JSPs) that use a special library of tags that work with Mathematica. JSPs support the embedding of Java into HTML, and are frequently used along with Java Servlets to develop large dynamic web sites. The library of tags is called the MSP Taglib and will work on any compliant servlet engine. One advantage of the use of a tag library is that it can completely hide any use of the Java programming language; this is the case with the MSP Taglib.
This chapter considers the basics of webMathematica scripts. It requires some knowledge of HTML, including form and input elements. A reference to HTML is included at the end of this document. If you have no understanding of form elements, it will be hard to write interactive examples for webMathematica.
The description given here will work through a collection of sample JSPs, each of which will demonstrate some detail or feature. The sources for all these examples are included in the webMathematica web application in the directory Examples (the full path in Tomcat would be webapps/webMathematica/Examples). If you followed the installation steps when you installed your server, you should be able to see these examples running live in your server. Please note that these examples are designed to be simple examples of how to program with webMathematica technology and have not been created for pleasing visual appearance.
These 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. To study the details of how to program for webMathematica this extra design may be a distraction and it is also possible to reach the examples without using the template.
When you have finished this chapter, you may wish to look at the next chapter: Developing Your Own Pages. This gives some ideas for getting started to develop your own site.
3.2 Working with Variables: Variables.jsp
3.3 MSP Functions: Expand.jsp
3.4 Graphics: Plot.jsp
3.5 Typeset Images: Integrate.jsp
3.6 Live 3D Plotting: Plot3DLive.jsp
3.7 Getting Messages: Messages.jsp
3.8 Returning General Content: Content.jsp
3.9 Applets: TextApplet.jsp
3.11 Setting Variables: SetBasic.jsp
3.12 Getting Variables: GetBasic.jsp
3.13 Interacting with MSPs: IncludeMSP.jsp