how can i return an array from the http servlet response.basically i am making a method wich takes a string as a parameter and hits the servlet URL wich(servlet) returns the array ...how can i do that ..pz tell
i am making a method wich takes a string as a parameter and hits the servlet URL wich(servlet) returns the array
I think the other responders are answering the wrong question.
By "hit the servlet URL" I suspect he means create a URLConnection to the servlet and send the string, then read the servlet response as an array of Strings. In that case, look at the java.net.URLConnection and HttpURLConnection classes. You might find using the Jakarta Commons HttpClient toolkit to be useful. Bill
Of course, returning an array as a serialised Java object is only good for Java clients... if there's any possibility that a client might be something else (some other thin desktop client, or even a PHP or Perl script), you would have to find some language-neutral way to return an array (which could be either a new binary format, or some string format [e.g. comma- or space-delimited] if it's a string array you're returning).
Charles Lyons (SCJP 1.4, April 2003; SCJP 5, Dec 2006; SCWCD 1.4b, April 2004)
Author of OCEJWCD Study Companion for Oracle Exam 1Z0-899 (ISBN 0955160340 / AmazonAmazon UK )
CLUCK LIKE A CHICKEN! Now look at this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss