放入cookie
var viewPanel = getComponent("viewPanel1");
var docIDArr:java.unit.vector = viewPanel.getSelectedIds();
var docID:String = docIDArr[0];
var db:DataBase = session.getCurrentDatabase();
var doc:NotesDocument = db.getDocumentByID(docID);
var Name:string = doc.getItemValueString("txtName");
var No:string = doc.getItemValueString("txtNo");
var response:javax.servlet.http.HttpServletResponse = facesContext.getExternalContext().getResponse();
var CookieNo:javax.servlet.http.Cookie = facesContext.getExternalContext().getRequestCookieMap().get("No");
var CookieName:javax.servlet.http.Cookie = facesContext.getExternalContext().getRequestCookieMap().get("Name");
if (null == CookieName){
CookieName = new javax.servlet.http.Cookie("Name",Name);
CookieNo = new javax.servlet.http.Cookie("No",No);
}else{
CookieName.setValue(Name);
CookieNo.setValue(No);
}
CookieName.setPath("/");
CookieNo.setPath("/")
response.addCookie(CookieName);
response.addCookie(CookieNo);
context.reloadPage()
取出cookies
var request:javax.servlet.http.HttpServletRequest = facesContext.getExternalContext().getRequest();
var Cookies:javax.servlet.http.Cookie = request.getCookies();
var i = 0;
for(i = 0;i<Cookies.length;i++){
if(Cookies[i].getName() == "Name"){
var Name:string = Cookies[i].getValue()
print(Name)
}
}