40
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 under
standing 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 webMath
ematica 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.1 Hello.jsp
If you installed webMathematica as described
above
, you should be able to connect to this JSP via
http://localhost:8080/webMathematica/Examples/Hello.jsp. (You may have some other URL for accessing your
server.)
This example evaluates the Date[] function of Mathematica. The result changes each time the page is accessed,
demonstrating that this really is a dynamic process. The source for this page is in webMathematica/Examples/
Hello.jsp.
.
<
New Page 1
Comcast Web Hosting