11.07.2015 Views

webMathematica™ Wolfram - Wolfram Research

webMathematica™ Wolfram - Wolfram Research

webMathematica™ Wolfram - Wolfram Research

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

64 webMathematica User GuideVariablesThere are two types of variables that are important for you to understand when you are gettingstarted with webMathematica: input variables and page variables.Input variables come with the HTTP web request, for example from an input field in an HTMLform. You can identify input variables in Mathematica code because they are labeled with a '$$'prefix. In the example below, the setting variable may be sent from an input field. In Mathematicacode it is called $$setting.If[ MSPValueQ[ $$setting],....]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 convertinginto Mathematica input. In particular, you should never use ToExpression on an input variable.An example of using MSPBlock is shown below.MSPBlock[ {$$fun},Integrate[ $$fun, x]]Page variables are Mathematica variables that you use to hold intermediate values. They arecalled page variables since they are cleared when the page is finished. In the example below,the page variable tmp is used to hold the expression that was entered into the text input field(which is held in an input variable called $$expr). Note the use of the secure function, MSPToExÖpression, to convert the Mathematica expression from the input.

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

Saved successfully!

Ooh no, something went wrong!