我是 jsp 新手,当我尝试通过一些名为 cId 和 passWord 的参数调用 jsp 页面时,出现此错误,我一直在尝试的代码如下所示,我已经遇到了相同的错误谷歌搜索,但我仍然遇到同样的问题。代码是:
<body>
<%
String cidMessage = "cID";
String passEncrypted = "passWord";
System.out.println("CID ISSSSSSSSSSSS"+cId);
if ((cId.equals(cidMessage)) && (passWord.equals(passEncrypted))) {
System.out.println("Validation Correct"+cId);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date = new Date();
String time = sdf.format(date.getTime());
String xmlOutput = "<smsreport>"
+ "<date>" + time + "</date>"
+ "<result>" + "SUCESS" + "</result>"
+ "<msgid>" + currentTimeMillis() + "</msgid>"
+ "<msgparts>" + "1" + "</msgparts>"
+ "</smsreport>";
try {
byte[] contents = xmlOutput.getBytes();
response.setContentType("text/xml");
response.setContentLength(contents.length);
response.getOutputStream().write(contents);
response.getOutputStream().flush();
} catch (Exception e) {
throw new ServletException(e);
}
} else {
System.out.println("Validation Wrong"+cId);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date = new Date();
String time = sdf.format(date.getTime());
String xmlOutput = "<smsreport>"
+ "<date>" + time + "</date>"
+ "<result>ERROR</result>"
+ "<msgid>" + "ErrorCode" + "</msgid>"
+ "<msgparts>" + "ErrorMessage" + "</msgparts>"
+ "</smsreport>";
try {
byte[] contents = xmlOutput.getBytes();
response.setContentType("text/xml");
response.setContentLength(contents.length);
response.getOutputStream().write(contents);
response.getOutputStream().flush();
} catch (Exception e) {
throw new ServletException(e);
}
}
%>
</body>