My Servlet
public class JSONServlet extends HttpServlet {
private static Gson gson = new Gson();
public void doPost (HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
{
res.setContentType("application/json");
res.getWriter().write(gson.toJson(returnVal));
}
}
我的后勤职能
login.login=function(parm0){
$.post(login.url,
{
operation: login ,
userID: admin ,
parmData0: JSON.stringify(parm0),
parmType0: com.company.share.svc.login.data.LoginData
},
function(data){
loginHandler(data);
},
json );
}
How I call my login function
login.login({userID: admin , password: admin , forceOut: true});
这导致火焰反应。
{"adminUserKey":{"userID":"admin"},"resultCode":0,"sessionID":3788474425691603010,"accountInfoData":[],"userID":"admin","successful":true}
结果是JSON在火力中被刺。
accountInfoData []
adminUserKey Object { userID="admin"}
resultCode 0
sessionID 3788474425691603000
successful true
userID "admin"
As you see sessionIDs are different in two tab. In every login.login(...) method call I get a new session ID.
function(data){ //But in callback method //data.sessionID is always 3788474425691603000 //and never changes. //But sessionID in firebug Response tab changes //ever login.login(...) call and it is true one }
我错了。 为什么我整整齐一届会议。