A simple pair of JSPs... The first is a simple example client based on the LoadXML.jsp.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib uri="http://www.wolfram.com/msp" prefix="msp" %>
<html>
<head>
<title>MathML Client</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="shortcut icon" href="../../Resources/Images/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" type="text/css" href="../../Resources/CSS/webMathematica.css" />
<script type="text/javascript" src="../../Resources/JavaScript/webMathematica.js"></script>
<script>
function submitStep() {
var xmlHttp;
try { // Firefox, Opera 8.0+, Safari
xmlHttp = new XMLHttpRequest();
if (xmlHttp.overrideMimeType) {
xmlHttp.overrideMimeType('text/xml');
}
} catch (e) {
// Internet Explorer
try {
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {
alert("Your browser does not support AJAX!");
return false;
}
}
}
xmlHttp.onreadystatechange = function () {
if (xmlHttp.readyState == 4) {
console.dir(xmlHttp);
document.getElementById("result").innerHTML = xmlHttp.response;
}
}
var url = "MathMLServer.jsp";
var step = '<math> <mn> 4 </mn> <mfenced> <mrow> <mi> y </mi> <mo> - </mo> <mn> 5 </mn> </mrow> </mfenced> <mo> - </mo> <mn> 3 </mn> <mi> y </mi> <mo> = </mo> <mo> - </mo> <mn> 1 </mn> </math>';
url = url + "?step=" + encodeURIComponent(step);
xmlHttp.open("POST", url, false);
xmlHttp.send(null);
}
</script>
</head>
<body>
<div class="container_noborder">
<div class="section">
<h1>MathML Test Page</h1>
</div>
<div class="section">
<button onclick="submitStep()">Submit Step</button>
</div>
<div class="section">
<span id="result"></span>
</div>
<p class="description">
A basic AJAX example that submits MathML to the server.
</p>
</div>
<h3>Messages</h3>
<msp:evaluate>
ColumnForm[MSPGetMessages[]]
</msp:evaluate>
<h3>Prints</h3>
<msp:evaluate>
ColumnForm[MSPGetPrintOutput[]]
</msp:evaluate>
</body>
</html>
The MathML in step above validates and renders fine on Wolfram's MathMLCentral.com.
And here is the server JSP MathMLServer.jsp...
<%@ page contentType="text/xml"%>
<%@ taglib uri="http://www.wolfram.com/msp" prefix="msp" %>
<msp:evaluate>
If[ MSPValueQ[ $$step ],
step = MSPToExpression[ $$step ];
]
MSPFormat[step, StandardForm]
</msp:evaluate>
webMathematica returns...
HTTP Status 403 - Value "<math> <mn> 4 </mn> <mfenced> <mrow> <mi> y </mi> <mo> - </mo> <mn> 5 </mn> </mrow> </mfenced> <mo> - </mo> <mn> 3 </mn> <mi> y </mi> <mo> = </mo> <mo> - </mo> <mn> 1 </mn> </math>" of input "$$step" contains disallowed symbols.
type Status report
message Value "<math> <mn> 4 </mn> <mfenced> <mrow> <mi> y </mi> <mo> - </mo> <mn> 5 </mn> </mrow> </mfenced> <mo> - </mo> <mn> 3 </mn> <mi> y </mi> <mo> = </mo> <mo> - </mo> <mn> 1 </mn> </math>" of input "$$step" contains disallowed symbols.
description Access to the specified resource has been forbidden.
Apache Tomcat/8.0.24
Any ideas would be appreciated.
Jim