如何用JSP来实现这一小段ASP功能,很简单,可是我写的总出错
<%@LANGUAGE="JAVASCRIPT" CODEPAGE="65001"%>
<%
Response.ContentType="text/xml";
var xmlString='<?xml version="1.0" encoding="UTF-8"?>';
xmlString+='<root>';
if (Request.QueryString("pId")=="0")
{
xmlString+='<node id="1" hasChildren="1">测试类别1</node>';
xmlString+='<node id="4" hasChildren="0">测试类别4</node>';
}
else if (Request.QueryString("pId")=="1")
{
xmlString+='<node id="2" hasChildren="1">测试类别2</node>';
xmlString+='<node id="5" hasChildren="0">测试类别5</node>';
}
else if (Request.QueryString("pId")=="2")
{
xmlString+='<node id="3" hasChildren="0">测试类别3</node>';
}
xmlString+='</root>';
Response.write(xmlString);
%>