11.07.2015 Views

webMathematica™ Wolfram - Wolfram Research

webMathematica™ Wolfram - Wolfram Research

webMathematica™ Wolfram - Wolfram Research

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

44 webMathematica User GuideMathematica now evaluates the contents of the msp:evaluate tag. The MSPBlock command isa programming construct, which here inspects two input variables, $$expr and $$num. If eitherof these has no value, MSPBlock returns a null string, which is why the first time you access thepage, you do not see a result. The values of both variables are then interpreted by Mathematica.If successful, the results of interpretation are substituted into the second argument or bodyof MSPBlock. In this example all instances of $$expr are substituted with the parsed value of$$expr, and the same is done for $$num. The result is then evaluated, formatted, and placed inthe HTML page, which is returned to the client.Interpretation of the variables by Mathematica can fail in two ways: the input might not bevalid Mathematica input (for example, f[}), or it might be dangerous input (such asReadList["/etc/passwd"]). In both cases, the inputs are rejected and an error messagegenerated. This demonstrates some of the security features of the system, which the Securitysection documents in detail. The use of variables is discussed further in Tips and Tricks:Variables.The formatting of the result of an msp:evaluate tag is discussed in more details in AdvancedTopics: Evaluation Formatting.Graphics: Plot.jspIf you installed webMathematica as described above, you should be able to connect to this JSPvia http://localhost:8080/webMathematica/Examples/Plot.jsp. (You may have some other URLfor accessing your server.)This example generates a plot. The source for this page is in webMathematica/Examples/Plot.jsp. A section that shows the form tag is shown below.Enter a function:remember input settings from one call to the nextEnter a number:

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!