任何人都可以解释如何使用存储在java'PKCS#12`密钥库中的证书来加密和解密文件?
任何人都可以告诉我如何从AJAX响应中提取Struts动作类返回的字符串?以下是我的代码片段:
JS电话:
xmlhttp=new XMLHttpRequest();
xmlhttp.open('POST', 'getMessage.do', false);
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlhttp.send();
alert(xmlhttp.responseText);
Run Code Online (Sandbox Code Playgroud)
在struts.xml
<action name="getMessage" class="SampleAction" method="getMessage"/>
Run Code Online (Sandbox Code Playgroud)
行动
public String getMessage() {
String msg = null;
HttpSession hSession = this.request.getSession(false);
if(null != hSession) {
if(null != hSession.getAttribute("user")) {
User user = (User) hSession.getAttribute("user");
if(null != user.account) {
msg = user.account.getMessage(); //Sample message
}
}
}
return msg;
}
Run Code Online (Sandbox Code Playgroud)
当我打印响应文本(使用警报)时,它打印包含所有HTML信息的消息.实际消息以粗体突出显示
回复消息
html> head> title> Apache Tomcat/5.0.28 - 错误报告/标题>样式>! - {font-family:Tahoma,Arial,sans-serif;颜色:白色;背景颜色:#525D76;字体大小:22px;} H2 {font-family:Tahoma,Arial,sans-serif; color:white; background-color:#525D76; font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;颜色:白色;背景颜色:#525D76;字体大小:14px;} BODY {font-family:Tahoma,Arial,sans-serif;颜色:黑色;背景颜色:白色;} B {font-family:Tahoma …