Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to get an applet value in json as output

 
Sabarish Venkat
Ranch Hand
Posts: 136
Java MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an applet code that displays my name in the applet browser. Now am trying to get my name as json output inside the same applet. Below is my code,



When i excute am getting my name in browser but there is no response from json and am not sure how to get it. Could anyone suggest an idea to solve this.
 
Carles Gasques
Ranch Hand
Posts: 199
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

If I understant correctly the api JSONObject this code has to do the trick



Best regards,
 
Sabarish Venkat
Ranch Hand
Posts: 136
Java MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your support carles, The idea you gave is not working for me. Am getting the same as before. Any other suggestions?
 
Carles Gasques
Ranch Hand
Posts: 199
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have tested this code
and the output is object correctly encoded in json
{"name":"Sabarish Venkat"}

Have I misunderstood your goal?
 
Sabarish Venkat
Ranch Hand
Posts: 136
Java MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That works when outside the applet but my goal is inside the applet i need to get the json
 
Carles Gasques
Ranch Hand
Posts: 199
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Why didn't work inside the applet?
 
Sabarish Venkat
Ranch Hand
Posts: 136
Java MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No idea about that.. still debugging it...If you have any other idea let me know thanks for your support carles
 
Sabarish Venkat
Ranch Hand
Posts: 136
Java MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got the solution, All i did is just put the code out of the paint method like below,
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic