How to pass an object from a java class to servlet?
问题 I am using Apache's HttpClient to call a servlet from a Java class. I want to send an object to the servlet which should save the object using Serialization. How to send the object to the servlet? public static void main(String[] args) { Names names = new Names(); names.setName("ABC"); names.setPlace("Bangalore"); HttpClient httpclient = new DefaultHttpClient(); HttpGet httpget = new HttpGet("http://localhost:9080/HttpClientPractice/FirstServlet"); //Rest of the code In the above code snippet