• Post Reply Bookmark Topic Watch Topic
  • New Topic

Writing objects to the output Vs Strings  RSS feed

 
chandana sapparapu
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
In my project I have to send output from a servlet to the client applet.
Two options in achieving what I want:

1. key=value pairs in strings and parse them at the client side. I have anywhere between 10-100 records, each record having 2-10 key, value pairs.

2. Writing an object array to the output.

Which one is better?

Thanks in advance.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Better how?
If you have key.value pairs, thats a Map type collection, why not just serialize the map with an ObjectOutputStream. Saves parsing on both sides and makes for really short code. You would have to use a map implementation that both applet and server have available, for example HashMap.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!