   [java] Servlets? Or something else
  What I'm trying to do:Write Java client and server programs that interact.Using servlets I can write a program which is placed on the server and can generate and process HTML forms. The HTML form generates an HTTP POST request and the HttpServlet handles it.However, I don't want to use an HTML form on the client side. I want to make my own Java app. So either I need to be able to generate HTTP requests or I need something else other than servlets.Please advise!   
  A HttpServlet responds to any HTTP request with any kind of data, it is not restricted to being called from a POST form and producing HTML.If you can send XML documents from the server to the client you can leverage most servlet-based "web" frameworks, including JSP; if not, there is ServletResponse.getOutputStream(). Creating HTTP request is easy, and there are many libraries to help with this common task (e.g. http://www.innovation.ch/java/HTTPClient/).   ;  I think what I was looking for was HttpUrlConnection...That works on the client side instead of a browser. It can call the servlet with the POST and GET method. Now I need to figure out how to set the parameters that get sent from HttpUrlConnection to HttpServlet using HttpUrlConnection...Thanks for the link. That looks like what I need!   ;Quote:Original post by yitzleThanks for the link. That looks like what I need!Well, it was just one of the first Google results, not an actual recommendation; you should look in the standard library and consider alternatives.;  You could create your own servlet protocol and use it in place of HttpServlet. But really, there's no call for that. You don't need to use the Servlet API to write client-server apps in Java. Look at the java.nio package instead.   