struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sharath karnati <>
Subject Re: Struts2 with JSON.
Date Tue, 05 Aug 2008 21:09:03 GMT
Hi All,
  I'm getting below value in req.responseText 
  which I'm passing for JSON
   jsonObject=eval( "("+ req.responseText +")" );
  How to read 'first__name' value from jsonObject?

--- On Mon, 8/4/08, sharath karnati <> wrote:

From: sharath karnati <>
Subject: Struts2 with JSON.
Date: Monday, August 4, 2008, 10:25 AM

Hi All,
   Using JSON, I'm getting below response from action
   In this response, 'com.beans.ComplaintDO' is a javabean.
'list' is a java arraylist and it may contain multiple
'com.beans.ComplaintDO' javabeans. 
  I'd like to know how to read this response in java script, I tried below
way but getting java script error(jsonObject has no properties)
function onReadyState() 
   alert('In onReadyState');
   var ready=req.readyState;
   var jsonObject=null;

   if ( ready == READY_STATE_COMPLETE )
     jsonObject=eval( req.responseText );    
     var searchresults = jsonObject.ComplaintDO.entry;    
     alert('In searchresults:'+searchresults.length);
   Please let me know how to read these values from json object.


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message