S
soup_or_power
Hi All
I use Ajax to call a JSP page that is heavy duty. After the JSP gets
done it will set a session variable as session.setAttribute("flag",
"1"). I read the session from Java and process it as follows:
try {
for (; {
Map m=
FacesContext.getCurrentInstance().getExternalContext().getSessionMap();
String flag=(String)m.get("pushsession1");
System.out.println("flag=" + flag);
if (flag == null || flag.trim().equals("")){
Thread.sleep(2000);
logger.debug("waiting for pushsession1");
System.out.println("waiting for pushsession1");
}
else {
m.put("pushsession1", "");
System.out.println("done pushsession1");
logger.debug("done pushsession1");
break;
}
}
} catch (Exception e) {};
I expect the java method to wait until the JSP gets done. What I am
seeing is the session in Java sometimes gets the correct value for
flag and some times gets null for the flag. Could someone please
clarify how to integrate JSP with Java using Ajax?
I tried using the volatile for flag as : volatile String flag=... and
got compiler error.
Thanks
I use Ajax to call a JSP page that is heavy duty. After the JSP gets
done it will set a session variable as session.setAttribute("flag",
"1"). I read the session from Java and process it as follows:
try {
for (; {
Map m=
FacesContext.getCurrentInstance().getExternalContext().getSessionMap();
String flag=(String)m.get("pushsession1");
System.out.println("flag=" + flag);
if (flag == null || flag.trim().equals("")){
Thread.sleep(2000);
logger.debug("waiting for pushsession1");
System.out.println("waiting for pushsession1");
}
else {
m.put("pushsession1", "");
System.out.println("done pushsession1");
logger.debug("done pushsession1");
break;
}
}
} catch (Exception e) {};
I expect the java method to wait until the JSP gets done. What I am
seeing is the session in Java sometimes gets the correct value for
flag and some times gets null for the flag. Could someone please
clarify how to integrate JSP with Java using Ajax?
I tried using the volatile for flag as : volatile String flag=... and
got compiler error.
Thanks