日期:2014-05-17 浏览次数:20991 次
function createXMLRequset(){
if(window.XMLHttpRequest){
XMLHttp = new XMLHttpRequest();
}else if(window.ActiveObject){
XMLHttp = new ActiveObject("Microsoft.XMLHTTP");
}
}
function doAjax(){
createXMLRequset();
XMLHttp.open("POST","initLogin.action",true);
XMLHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded;");
XMLHttp.onreadystatechange = p;
XMLHttp.send(null);
}
function p(){
if(XMLHttp.readyState == 4){
if(XMLHttp.status == 200){
var str = XMLHttp.responseText;
document.getElementById("init").src=str;
}
}
}
public String initLogin(){
RandomNumUtil randomNumUtil = RandomNumUtil.Instance();
this.setInputStream(randomNumUtil.getImage());
ActionContext.getContext().getSession().put("random", randomNumUtil.getString());
return SUCCESS;
}
function p(){
if(XMLHttp.readyState == 4){
if(XMLHttp.status == 200){
var str = XMLHttp.responseText;
document.getElementById("init").src=str;
}
}