English 中文(简体)
为什么反应和JSON tab在火力中有所不同
原标题:Why Response and JSON tab is different in firebug

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
}

我错了。 为什么我整整齐一届会议。

最佳回答

Java本在内部使用双倍值(64轨浮动),以体现数字价值,因此大量数字的精确度有限,四舍五入。 我在AJAX/JSON-stuff面前 hit过这个问题,解决办法是把会议安排为平地,而不是若干次(“会议安排”:3788474425691603010 诉“会议安排”:3788474425691603010”)

问题回答

暂无回答




相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签